Avoid search cache loading flicker
This commit is contained in:
@@ -83,7 +83,7 @@ export function SearchPanel({
|
|||||||
const cachedTags = readJSONCache<PostListResponse>(tagsUrl);
|
const cachedTags = readJSONCache<PostListResponse>(tagsUrl);
|
||||||
if (cachedTags) setTags(extractTags(itemsOrEmpty(cachedTags.items)));
|
if (cachedTags) setTags(extractTags(itemsOrEmpty(cachedTags.items)));
|
||||||
|
|
||||||
setIsTagLoading(true);
|
setIsTagLoading(!cachedTags);
|
||||||
getJSON<PostListResponse>(tagsUrl)
|
getJSON<PostListResponse>(tagsUrl)
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
if (cancelled) return;
|
if (cancelled) return;
|
||||||
@@ -118,7 +118,7 @@ export function SearchPanel({
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
setIsPostLoading(true);
|
setIsPostLoading(!cachedPosts);
|
||||||
getJSON<PostListResponse>(searchUrl)
|
getJSON<PostListResponse>(searchUrl)
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
const exactMatches = itemsOrEmpty(res.items).filter((post) =>
|
const exactMatches = itemsOrEmpty(res.items).filter((post) =>
|
||||||
|
|||||||
Reference in New Issue
Block a user