Skip to content

armgit / papra

Public Imported from GitHub
0

The minimalistic document archiving platform.

fix(demo): case insensitive dummy search in demo (#367)

Corentin Thomasset57c6a26657a4
diff --git a/apps/papra-client/src/modules/demo/demo-api-mock.ts b/apps/papra-client/src/modules/demo/demo-api-mock.ts
index 9bdf8613..be992541 100644
--- a/apps/papra-client/src/modules/demo/demo-api-mock.ts
+++ b/apps/papra-client/src/modules/demo/demo-api-mock.ts
@@ -193,7 +193,7 @@ const inMemoryApiMock: Record<string, { handler: any }> = {
const {
pageIndex = 0,
pageSize = 5,
- searchQuery = '',
+ searchQuery: rawSearchQuery = '',
} = query ?? {};
const organization = organizationStorage.getItem(organizationId);
@@ -201,7 +201,9 @@ const inMemoryApiMock: Record<string, { handler: any }> = {
const documents = await findMany(documentStorage, document => document?.organizationId === organizationId);
- const filteredDocuments = documents.filter(document => document?.name.includes(searchQuery) && !document?.deletedAt);
+ const searchQuery = rawSearchQuery.trim().toLowerCase();
+
+ const filteredDocuments = documents.filter(document => document?.name.toLowerCase().includes(searchQuery) && !document?.deletedAt);
return {
documents: filteredDocuments.slice(pageIndex * pageSize, (pageIndex + 1) * pageSize),