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:
@@ -1,6 +1,7 @@
|
||||
<script lang="ts">
|
||||
import { api } from '$lib/api/client';
|
||||
import type { Tag, TagOffsetPage } from '$lib/api/types';
|
||||
import type { Tag } from '$lib/api/types';
|
||||
import { fetchAllTags } from '$lib/api/tags';
|
||||
|
||||
interface Props {
|
||||
fileIds: string[];
|
||||
@@ -30,13 +31,13 @@
|
||||
error = '';
|
||||
try {
|
||||
const [tagsRes, commonRes] = await Promise.all([
|
||||
api.get<TagOffsetPage>('/tags?limit=200&sort=name&order=asc'),
|
||||
fetchAllTags(),
|
||||
api.post<{ common_tag_ids: string[]; partial_tag_ids: string[] }>(
|
||||
'/files/bulk/common-tags',
|
||||
{ file_ids: fileIds }
|
||||
)
|
||||
]);
|
||||
allTags = tagsRes.items ?? [];
|
||||
allTags = tagsRes;
|
||||
commonIds = new Set(commonRes.common_tag_ids ?? []);
|
||||
partialIds = new Set(commonRes.partial_tag_ids ?? []);
|
||||
} catch {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<script lang="ts">
|
||||
import { api } from '$lib/api/client';
|
||||
import type { Tag, TagOffsetPage } from '$lib/api/types';
|
||||
import type { Tag } from '$lib/api/types';
|
||||
import { fetchAllTags } from '$lib/api/tags';
|
||||
import { buildDslFilter, parseDslFilter, tokenLabel } from '$lib/utils/dsl';
|
||||
|
||||
interface Props {
|
||||
@@ -26,8 +26,8 @@
|
||||
});
|
||||
|
||||
$effect(() => {
|
||||
api.get<TagOffsetPage>('/tags?limit=200&sort=name&order=asc').then((page) => {
|
||||
tags = page.items ?? [];
|
||||
fetchAllTags().then((all) => {
|
||||
tags = all;
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<script lang="ts">
|
||||
import { api } from '$lib/api/client';
|
||||
import type { Tag, TagOffsetPage } from '$lib/api/types';
|
||||
import type { Tag } from '$lib/api/types';
|
||||
import { fetchAllTags } from '$lib/api/tags';
|
||||
|
||||
interface Props {
|
||||
fileTags: Tag[];
|
||||
@@ -15,8 +15,8 @@
|
||||
let busy = $state(false);
|
||||
|
||||
$effect(() => {
|
||||
api.get<TagOffsetPage>('/tags?limit=200&sort=name&order=asc').then((p) => {
|
||||
allTags = p.items ?? [];
|
||||
fetchAllTags().then((all) => {
|
||||
allTags = all;
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user