The minimalistic document archiving platform.
feat(command-palette): use toArrayIf instead of ternary (#874)
Corentin Thomasset4c772105f1e8
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.tsxindex e6188294..866a3019 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@@ -6,6 +6,7 @@ import { getDocumentIcon, makeDocumentSearchPermalink } from '../documents/documimport { searchDocuments } from '../documents/documents.services';import { useI18n } from '../i18n/i18n.provider';import { cn } from '../shared/style/cn';+import { toArrayIf } from '../shared/utils/array';import { debounce } from '../shared/utils/timing';import { useThemeStore } from '../theme/theme.store';import { CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandLoading } from '../ui/components/command';@@ -100,14 +101,15 @@ export const CommandPaletteProvider: ParentComponent = (props) => {forceMatch: true,})),- ...(getMatchingDocumentsTotalCount() > getMatchingDocuments().length- ? [{- label: t('command-palette.show-more-results', { count: getMatchingDocumentsTotalCount() - getMatchingDocuments().length, query: getSearchQuery() }),- icon: 'i-tabler-search',- action: () => navigate(makeDocumentSearchPermalink({ organizationId: params.organizationId, search: { query: getSearchQuery() } })),- forceMatch: true,- }]- : []),+ ...toArrayIf(+ getMatchingDocumentsTotalCount() > getMatchingDocuments().length,+ {+ label: t('command-palette.show-more-results', { count: getMatchingDocumentsTotalCount() - getMatchingDocuments().length, query: getSearchQuery() }),+ icon: 'i-tabler-search',+ action: () => navigate(makeDocumentSearchPermalink({ organizationId: params.organizationId, search: { query: getSearchQuery() } })),+ forceMatch: true,+ },+ ),],},{