address comments left by @mrubens on #1090 (Fix settings done button with unsaved changes);

This commit is contained in:
ellipsis-dev[bot] 2025-02-20 18:25:52 +00:00 committed by GitHub
parent e69f27d319
commit 6f9ada5eb0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -217,13 +217,16 @@ const SettingsView = forwardRef<SettingsViewRef, SettingsViewProps>(({ onDone },
const onConfirmDialogResult = useCallback((confirm: boolean) => {
if (confirm) {
setChangeDetected(false)
// Wait for the change detection to be updated
setTimeout(() => {
confirmDialogHandler.current?.()
}, 100)
}
}, [])
useEffect(() => {
if (!isChangeDetected && confirmDialogHandler.current) {
confirmDialogHandler.current();
confirmDialogHandler.current = undefined; // Clear the handler after execution
}
}, [isChangeDetected]);
const handleResetState = () => {
vscode.postMessage({ type: "resetState" })
}