Skip to content

armgit / papra

Public Imported from GitHub
0

The minimalistic document archiving platform.

fix(tags): preserve tag name casing in inline picker (#1296)

Corentin Thomassetdf9f6c671616
diff --git a/.changeset/slick-buttons-watch.md b/.changeset/slick-buttons-watch.md
new file mode 100644
index 00000000..27d4dbe9
--- /dev/null
+++ b/.changeset/slick-buttons-watch.md
@@ -0,0 +1,5 @@
+---
+'@papra/app': patch
+---
+
+Fixed the inline tag picker lowercasing the typed name when suggesting a new tag, so newly created tags now keep their original casing (e.g. typing "Invoices" no longer suggests "invoices").
diff --git a/apps/papra-client/src/modules/tags/components/tag-list.component.tsx b/apps/papra-client/src/modules/tags/components/tag-list.component.tsx
index a02ba0d9..c86b818b 100644
--- a/apps/papra-client/src/modules/tags/components/tag-list.component.tsx
+++ b/apps/papra-client/src/modules/tags/components/tag-list.component.tsx
@@ -67,7 +67,7 @@ const TagPicker: Component<{
highlightNext,
highlightPrevious,
getListItems,
- getNormalizedFilterQuery,
+ getTrimmedFilterQuery,
} = useTagPicker({
getAvailableTags: () => tagsQuery.data?.tags ?? [],
getSelectedTagIds: () => props.selectedTags?.map((tag) => tag.id) ?? [],
@@ -166,7 +166,7 @@ const TagPicker: Component<{
<CreateTagModal
open={getIsTagCreationModalOpen()}
onOpenChange={setIsTagCreationModalOpen}
- initialName={getNormalizedFilterQuery()}
+ initialName={getTrimmedFilterQuery()}
onTagCreated={handleTagCreated}
organizationId={props.organizationId}
/>
diff --git a/apps/papra-client/src/modules/tags/components/use-tag-picker.hook.ts b/apps/papra-client/src/modules/tags/components/use-tag-picker.hook.ts
index b95da3d1..1087e488 100644
--- a/apps/papra-client/src/modules/tags/components/use-tag-picker.hook.ts
+++ b/apps/papra-client/src/modules/tags/components/use-tag-picker.hook.ts
@@ -34,7 +34,8 @@ export function useTagPicker(options: UseTagPickerOptions) {
const initiallySelectedTagIds = options.getSelectedTagIds?.() ?? [];
- const getNormalizedFilterQuery = createMemo(() => filterQuery().trim().toLowerCase());
+ const getTrimmedFilterQuery = createMemo(() => filterQuery().trim());
+ const getNormalizedFilterQuery = createMemo(() => getTrimmedFilterQuery().toLowerCase());
const getTagsListItems = createMemo<TagPickerListItemTag[]>(() =>
options
@@ -85,7 +86,7 @@ export function useTagPicker(options: UseTagPickerOptions) {
...nonInitiallySelectedTagsItems,
...toArrayIf(shouldShowCreateOption(), {
type: 'create-new-tag-button',
- name: getNormalizedFilterQuery(),
+ name: getTrimmedFilterQuery(),
} as const),
];
});
@@ -170,6 +171,7 @@ export function useTagPicker(options: UseTagPickerOptions) {
filterQuery,
setFilterQuery,
getNormalizedFilterQuery,
+ getTrimmedFilterQuery,
getTagsListItems,
highlighted,
highlightNext,