mirror of
https://github.com/binaricat/Netcatty.git
synced 2026-11-25 18:16:32 +00:00
fix(scripts): harden delete handler against stale vault state
Read snippets/hosts from refs in the shared delete listener so rapid confirms cannot resurrect already-removed items, and clear pending bulk delete when the scripts panel hides so the confirm dialog does not resurface after a mid-prompt hide. Co-authored-by: 陈大猫 <binaricat@users.noreply.github.com>
This commit is contained in:
4 files changed
+33
-2
No files matched your search
@@ -389,6 +389,10 @@ const ScriptsSidePanelInner: React.FC<ScriptsSidePanelProps> = ({
|
||||
});
|
||||
}, [snippets]);
|
||||
|
||||
useEffect(() => {
|
||||
if (!isVisible) setPendingDeleteIds(null);
|
||||
}, [isVisible]);
|
||||
|
||||
const toggleSnippetSelection = useCallback((id: string) => {
|
||||
setSelectedSnippetIds((prev) => {
|
||||
const next = new Set(prev);
|
||||
|
||||
Reference in new issue
Block a user