mirror of
https://github.com/documenso/documenso.git
synced 2026-09-29 16:24:30 +10:00
fix: correctly deselect settings when changing envelope items
This commit is contained in:
@@ -246,6 +246,21 @@ export const EnvelopeEditorFieldsPage = () => {
|
|||||||
editorFields.setSelectedRecipient(firstSelectableRecipient?.id ?? null);
|
editorFields.setSelectedRecipient(firstSelectableRecipient?.id ?? null);
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Deselect a field or content which is not on the current envelope item
|
||||||
|
* when the item changes, otherwise its settings stay open in the sidebar for
|
||||||
|
* something which is no longer on screen.
|
||||||
|
*/
|
||||||
|
useEffect(() => {
|
||||||
|
if (editorFields.selectedField && editorFields.selectedField.envelopeItemId !== currentEnvelopeItem?.id) {
|
||||||
|
editorFields.setSelectedField(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (editorContents.selectedContent && editorContents.selectedContent.envelopeItemId !== currentEnvelopeItem?.id) {
|
||||||
|
editorContents.setSelectedContent(null);
|
||||||
|
}
|
||||||
|
}, [currentEnvelopeItem?.id]);
|
||||||
|
|
||||||
const onDetectClick = () => {
|
const onDetectClick = () => {
|
||||||
if (!team.preferences.aiFeaturesEnabled) {
|
if (!team.preferences.aiFeaturesEnabled) {
|
||||||
setIsAiEnableDialogOpen(true);
|
setIsAiEnableDialogOpen(true);
|
||||||
|
|||||||
Reference in New Issue
Block a user