fix(frontend): load full tag/category lists in pickers, honoring sort
deploy / deploy (push) Successful in 19s

The tag pickers, filter bar and batch editor loaded only /tags?limit=200 and
filtered client-side, so with more than 200 tags the rest were invisible and
unsearchable. Same for the category dropdowns on the tag forms.

Add fetchAllTags / fetchAllCategories helpers that page past the server's
per-request cap of 200, and order results by the sort the user chose on the
tags / categories page (tagSorting / categorySorting) instead of a hardcoded
name-asc. Wire them into FilterBar, TagPicker, TagRuleEditor, BulkTagEditor and
the tag new/edit category dropdowns.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-06-11 13:58:23 +03:00
parent aae0c587e8
commit 88a8cac048
8 changed files with 82 additions and 20 deletions
+4 -3
View File
@@ -2,7 +2,8 @@
import { goto } from '$app/navigation';
import { page } from '$app/state';
import { api, ApiError } from '$lib/api/client';
import type { Category, CategoryOffsetPage, Tag, TagRule } from '$lib/api/types';
import type { Category, Tag, TagRule } from '$lib/api/types';
import { fetchAllCategories } from '$lib/api/categories';
import TagRuleEditor from '$lib/components/tag/TagRuleEditor.svelte';
import ConfirmDialog from '$lib/components/common/ConfirmDialog.svelte';
@@ -32,12 +33,12 @@
loadError = '';
void Promise.all([
api.get<Tag>(`/tags/${id}`),
api.get<CategoryOffsetPage>('/categories?limit=200&sort=name&order=asc'),
fetchAllCategories(),
api.get<TagRule[]>(`/tags/${id}/rules`).catch(() => [] as TagRule[])
])
.then(([t, cats, r]) => {
tag = t;
categories = cats.items ?? [];
categories = cats;
rules = r;
name = t.name ?? '';
+4 -3
View File
@@ -1,7 +1,8 @@
<script lang="ts">
import { goto } from '$app/navigation';
import { api, ApiError } from '$lib/api/client';
import type { Category, CategoryOffsetPage } from '$lib/api/types';
import type { Category } from '$lib/api/types';
import { fetchAllCategories } from '$lib/api/categories';
let name = $state('');
let notes = $state('');
@@ -13,8 +14,8 @@
let categories = $state<Category[]>([]);
$effect(() => {
api.get<CategoryOffsetPage>('/categories?limit=200&sort=name&order=asc').then((p) => {
categories = p.items ?? [];
fetchAllCategories().then((all) => {
categories = all;
});
});