From 994ade013bf4fc105562d6d82f43664bae57eb8d Mon Sep 17 00:00:00 2001 From: Riad Benguella Date: Tue, 24 Dec 2024 14:21:16 +0100 Subject: [PATCH 1/2] Editor: Fix initial edits applied again after saving the post --- packages/editor/src/components/provider/index.js | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/packages/editor/src/components/provider/index.js b/packages/editor/src/components/provider/index.js index 4b8a3b6b23c251..5005b7521571ba 100644 --- a/packages/editor/src/components/provider/index.js +++ b/packages/editor/src/components/provider/index.js @@ -300,15 +300,7 @@ export const ExperimentalEditorProvider = withRegistryProvider( } ); } - }, [ - createWarningNotice, - initialEdits, - settings, - post, - recovery, - setupEditor, - updatePostLock, - ] ); + }, [] ); // Synchronizes the active post with the state useEffect( () => { From 98e8a2bab6807183a09db54e4beb33bab35907df Mon Sep 17 00:00:00 2001 From: Riad Benguella Date: Tue, 24 Dec 2024 14:36:53 +0100 Subject: [PATCH 2/2] Add comment --- packages/editor/src/components/provider/index.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/editor/src/components/provider/index.js b/packages/editor/src/components/provider/index.js index 5005b7521571ba..abdab284cfd138 100644 --- a/packages/editor/src/components/provider/index.js +++ b/packages/editor/src/components/provider/index.js @@ -300,6 +300,10 @@ export const ExperimentalEditorProvider = withRegistryProvider( } ); } + + // The dependencies of the hook are omitted deliberately + // We only want to run setupEditor (with initialEdits) only once per post. + // A better solution in the future would be to split this effect into multiple ones. }, [] ); // Synchronizes the active post with the state