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.
This commit is contained in:
James Mikrut
2024-08-27 14:56:28 -04:00
committed by GitHub
parent 2bbb02b9c0
commit 3d714d3e72

View File

@@ -280,6 +280,7 @@ export const Document: React.FC<AdminViewProps> = async ({
initialData={data}
initialState={formState}
isEditing={isEditing}
key={locale?.code}
>
{!RootViewOverride && (
<DocumentHeader