Skip to content

armgit / papra

Public Imported from GitHub
0

The minimalistic document archiving platform.

feat(command-palette): retain search query and results on reopen (#903)

Corentin Thomassetd13c74f0dbe5
diff --git a/.changeset/pink-vans-eat.md b/.changeset/pink-vans-eat.md
new file mode 100644
index 00000000..5fc3eb10
--- /dev/null
+++ b/.changeset/pink-vans-eat.md
@@ -0,0 +1,5 @@
+---
+"@papra/app": patch
+---
+
+The command palette state no longer resets when opening it, allowing to keep the search query and results when closing and reopening it.
diff --git a/apps/papra-client/src/modules/command-palette/command-palette.provider.tsx b/apps/papra-client/src/modules/command-palette/command-palette.provider.tsx
index 32bffabc..ca15c96b 100644
--- a/apps/papra-client/src/modules/command-palette/command-palette.provider.tsx
+++ b/apps/papra-client/src/modules/command-palette/command-palette.provider.tsx
@@ -75,16 +75,6 @@ export const CommandPaletteProvider: ParentComponent = (props) => {
},
));
- createEffect(on(
- getIsCommandPaletteOpen,
- (isCommandPaletteOpen) => {
- if (isCommandPaletteOpen) {
- setMatchingDocuments([]);
- setMatchingDocumentsTotalCount(0);
- }
- },
- ));
-
const getCommandData = (): {
label: string;
forceMatch?: boolean;
@@ -153,7 +143,11 @@ export const CommandPaletteProvider: ParentComponent = (props) => {
onOpenChange={setIsCommandPaletteOpen}
>
- <CommandInput onValueChange={setSearchQuery} placeholder={t('command-palette.search.placeholder')} />
+ <CommandInput
+ value={getSearchQuery()}
+ onValueChange={setSearchQuery}
+ placeholder={t('command-palette.search.placeholder')}
+ />
<CommandList>
<Show when={getIsLoading()}>
<CommandLoading>