mirror of
https://github.com/EnixCoda/Gitako.git
synced 2026-03-11 08:54:44 +00:00
fix: prevent resetting node state when toggle search mode but search input is empty
fix #217
This commit is contained in:
parent
5efbf8354d
commit
dbdc3828ac
2 changed files with 3 additions and 1 deletions
|
|
@ -48,7 +48,8 @@ export function SearchBar({ onSearch, onFocus, value }: Props) {
|
|||
configs.onChange({
|
||||
searchMode: newMode,
|
||||
})
|
||||
onSearch(value, newMode)
|
||||
// Skip search if no input to prevent resetting folder expansions
|
||||
if (value) onSearch(value, newMode)
|
||||
}}
|
||||
aria-label={toggleButtonDescription}
|
||||
>
|
||||
|
|
|
|||
|
|
@ -322,6 +322,7 @@ class FlattenLayer extends CompressLayer {
|
|||
this.expandedNodes.clear()
|
||||
if (restoreExpandedFolders) {
|
||||
this.backupExpandedNodes.forEach(path => this.expandedNodes.add(path))
|
||||
this.backupExpandedNodes.clear()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue