fix(sidebar): preserve results when enabling regex search

This commit is contained in:
OOMEcho authored and GitHub committed 2026-09-29 11:56:31 +08:00
1 parent 77c542248d
commit 03b3f4c4fa
3 files changed
+22 -3

No files matched your search

@@ -106,3 +106,13 @@ export function resolveSidebarSearchDispatchMode(transition: SidebarSearchTransi
if (transition.wasRegexMode && !transition.query) return "none";
return "ordinary";
}
/**
* Keep an ordinary-search projection available while a non-empty regex is
* filtering it. Restoring those tracked nodes on the mode switch can remove
* the only currently loaded matches before a local table index exists. The
* projection is restored once the regex query is cleared.
*/
export function shouldRestoreTrackedSidebarSearchTargetsInRegexMode(query: string): boolean {
return query.length === 0;
}