From f88149ba0c2ec7a3cdf214698ce8679c537a7203 Mon Sep 17 00:00:00 2001 From: HiDeoo <494699+HiDeoo@users.noreply.github.com> Date: Fri, 30 Dec 2022 09:52:19 +0100 Subject: [PATCH] Fix potential focus restoration issue when saving a todo https://github.com/FormidableLabs/use-editable/pull/27 --- CHANGELOG.md | 1 + package.json | 3 +++ patches/use-editable@2.3.3.patch | 13 +++++++++++++ pnpm-lock.yaml | 10 ++++++++-- 4 files changed, 25 insertions(+), 2 deletions(-) create mode 100644 patches/use-editable@2.3.3.patch diff --git a/CHANGELOG.md b/CHANGELOG.md index c623b6f..dd07494 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ All notable changes to this project will be documented in this file. ### 🐞 Bug Fixes - Fix an issue preventing to save a todo after deleting a todo node while preserving its children. +- Fix a potential focus restoration issue when saving a todo. - Fix an issue with the command and navigation palettes sometime displaying only partial results. ## v0.3.0 diff --git a/package.json b/package.json index d2c013c..170e567 100644 --- a/package.json +++ b/package.json @@ -135,6 +135,9 @@ }, "packageManager": "pnpm@7.13.0", "pnpm": { + "patchedDependencies": { + "use-editable@2.3.3": "patches/use-editable@2.3.3.patch" + }, "peerDependencyRules": { "ignoreMissing": [ "vite" diff --git a/patches/use-editable@2.3.3.patch b/patches/use-editable@2.3.3.patch new file mode 100644 index 0000000..c6073cd --- /dev/null +++ b/patches/use-editable@2.3.3.patch @@ -0,0 +1,13 @@ +diff --git a/dist/use-editable.es.js b/dist/use-editable.es.js +index 96b260cf6b3b167b640bf903a9dbae652e883d31..05a6c055433839b332eb52b6809adf3e7ebd9f59 100644 +--- a/dist/use-editable.es.js ++++ b/dist/use-editable.es.js +@@ -174,7 +174,7 @@ export function useEditable(c, a, b) { + } + return h; + } +- })); ++ }), [ c, a, b.disabled, e, e.disconnected, e.observer, e.position ]); + useLayoutEffect((function() { + if (!c.current || b.disabled) { + e.history.length = 0, e.historyAt = -1; \ No newline at end of file diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 9c4c1b8..2205be1 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -1,5 +1,10 @@ lockfileVersion: 5.4 +patchedDependencies: + use-editable@2.3.3: + hash: 6pf2bqqvqnphzd2hlnhi4xko5i + path: patches/use-editable@2.3.3.patch + specifiers: '@faker-js/faker': 7.6.0 '@hideoo/eslint-config': 0.14.1 @@ -171,7 +176,7 @@ dependencies: throttle-debounce: 5.0.0 ua-parser-js: 1.0.32 url-slug: 3.0.4 - use-editable: 2.3.3_react@18.2.0 + use-editable: 2.3.3_6pf2bqqvqnphzd2hlnhi4xko5i_react@18.2.0 zod: 3.20.2 devDependencies: @@ -6383,13 +6388,14 @@ packages: tslib: 2.4.1 dev: false - /use-editable/2.3.3_react@18.2.0: + /use-editable/2.3.3_6pf2bqqvqnphzd2hlnhi4xko5i_react@18.2.0: resolution: {integrity: sha512-7wVD2JbfAFJ3DK0vITvXBdpd9JAz5BcKAAolsnLBuBn6UDDwBGuCIAGvR3yA2BNKm578vAMVHFCWaOcA+BhhiA==} peerDependencies: react: '>= 16.8.0' dependencies: react: 18.2.0 dev: false + patched: true /use-isomorphic-layout-effect/1.1.2_kzbn2opkn2327fwg5yzwzya5o4: resolution: {integrity: sha512-49L8yCO3iGT/ZF9QttjwLF/ZD9Iwto5LnH5LmEdk/6cFmXddqi2ulF0edxTwjj+7mqvpVVGQWvbXZdn32wRSHA==}