Skip to content

Commit 24ebb02

Browse files
mcsfyouknowriad
authored andcommitted
Local autosave: Clear after successful save (#18051)
* Local autosave: Clear after successful save Presumably, somewhere in the fixing of conflicts between remote and local autosaves (purge local upon successful remote autosave), LocalAutosaveMonitor stopped purging the local autosave upon successful *saves*.
1 parent 4441a24 commit 24ebb02

File tree

1 file changed

+6
-1
lines changed
  • packages/editor/src/components/local-autosave-monitor

1 file changed

+6
-1
lines changed

packages/editor/src/components/local-autosave-monitor/index.js

+6-1
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,12 @@ function useAutosavePurge() {
142142
const lastIsAutosaving = useRef( isAutosaving );
143143

144144
useEffect( () => {
145-
if ( lastIsAutosaving.current && ! isAutosaving && ! didError ) {
145+
if (
146+
! didError && (
147+
( lastIsAutosaving.current && ! isAutosaving ) ||
148+
( lastIsDirty.current && ! isDirty )
149+
)
150+
) {
146151
localAutosaveClear( postId );
147152
}
148153

0 commit comments

Comments
 (0)