Skip to content

Commit 3d714d3

Browse files
authored
fix: locale selector + autosave race condition (#7891)
## Description Fixes a race condition where you could switch locales and have autosave trigger with old locale data. By adding the `key` to the `Document` component, we will ensure that the entire `Document` will be un-mounted and re-mounted between locale switches.
1 parent 2bbb02b commit 3d714d3

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

packages/next/src/views/Document/index.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,7 @@ export const Document: React.FC<AdminViewProps> = async ({
280280
initialData={data}
281281
initialState={formState}
282282
isEditing={isEditing}
283+
key={locale?.code}
283284
>
284285
{!RootViewOverride && (
285286
<DocumentHeader

0 commit comments

Comments
 (0)