fix: changing the title and body content in quick succession would trigger unsaved changes warning prompt (#2950)
changing the title and body content in quick succession would trigger unsaved changes warning prompt
This commit is contained in:
@@ -466,9 +466,20 @@ class DocumentScene extends React.Component<Props> {
|
||||
!this.isUploading &&
|
||||
!team?.collaborativeEditing
|
||||
}
|
||||
message={t(
|
||||
`You have unsaved changes.\nAre you sure you want to discard them?`
|
||||
)}
|
||||
message={(location, action) => {
|
||||
if (
|
||||
// a URL replace matching the current document indicates a title change
|
||||
// no guard is needed for this transition
|
||||
action === "REPLACE" &&
|
||||
location.pathname === editDocumentUrl(document)
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return t(
|
||||
`You have unsaved changes.\nAre you sure you want to discard them?`
|
||||
) as string;
|
||||
}}
|
||||
/>
|
||||
<Prompt
|
||||
when={this.isUploading && !this.isEditorDirty}
|
||||
|
||||
Reference in New Issue
Block a user