fix(frontend): load full tag/category lists in pickers, honoring sort
deploy / deploy (push) Successful in 19s
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:
@@ -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 ?? '';
|
||||
|
||||
@@ -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;
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user