Avoid search cache loading flicker

This commit is contained in:
TerryM
2026-05-28 23:17:49 +08:00
parent 320739f91b
commit f7828d8776

View File

@@ -83,7 +83,7 @@ export function SearchPanel({
const cachedTags = readJSONCache<PostListResponse>(tagsUrl);
if (cachedTags) setTags(extractTags(itemsOrEmpty(cachedTags.items)));
setIsTagLoading(true);
setIsTagLoading(!cachedTags);
getJSON<PostListResponse>(tagsUrl)
.then((res) => {
if (cancelled) return;
@@ -118,7 +118,7 @@ export function SearchPanel({
);
}
setIsPostLoading(true);
setIsPostLoading(!cachedPosts);
getJSON<PostListResponse>(searchUrl)
.then((res) => {
const exactMatches = itemsOrEmpty(res.items).filter((post) =>