Skip to content

Commit a447890

Browse files
TiZoriiViktorSvertoka
authored andcommitted
fix initial load flash and code review findings in learned terms
1 parent bad57a1 commit a447890

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

frontend/components/dashboard/ExplainedTermsCard.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ export function ExplainedTermsCard() {
2929
const [terms, setTerms] = useState<string[]>([]);
3030
const [hiddenTerms, setHiddenTerms] = useState<string[]>([]);
3131
const [loadError, setLoadError] = useState(false);
32+
const [isInitialLoad, setIsInitialLoad] = useState(true);
3233

3334
useEffect(() => {
3435
getLearnedTerms()
@@ -54,10 +55,12 @@ export function ExplainedTermsCard() {
5455
startTransition(() => {
5556
setTerms(visible);
5657
setHiddenTerms(hidden);
58+
setIsInitialLoad(false);
5759
});
5860
})
5961
.catch(() => {
6062
setLoadError(true);
63+
setIsInitialLoad(false);
6164
});
6265
}, []);
6366
const [showMore, setShowMore] = useState(false);
@@ -348,7 +351,7 @@ export function ExplainedTermsCard() {
348351
})}
349352
</div>
350353
</>
351-
) : (
354+
) : !isInitialLoad ? (
352355
<div className="py-6 text-center">
353356
<p className="text-sm font-medium text-gray-600 dark:text-gray-300">
354357
{t('empty')}
@@ -357,7 +360,7 @@ export function ExplainedTermsCard() {
357360
{t('emptyHint')}
358361
</p>
359362
</div>
360-
)}
363+
) : null}
361364

362365
{/* Explained Terms Section */}
363366
<div className="mt-6">

0 commit comments

Comments
 (0)