1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-09-24 17:51:14 +02:00

fix: Only show "not enough data" text when there isn't enough data.

The previous implementation had a small bug where it would show "not enough data" even if the graph was loading. This commit fixes that.

While working, I thought that maybe we should keep the current data while we're fetching new data instead of adding a cover, but all the other graphs use a cover when loading, so I've not made any changes to that effect.
This commit is contained in:
Thomas Heartman 2025-09-03 11:23:07 +02:00
parent fb40bb07c4
commit 8d8d3fae89
No known key found for this signature in database
GPG Key ID: BD1F880DAED1EE78

View File

@ -139,6 +139,7 @@ export const CreationArchiveChart: FC<ICreationArchiveChartProps> = ({
}, [creationVsArchivedChart, theme]); }, [creationVsArchivedChart, theme]);
const useGraphCover = notEnoughData || isLoading; const useGraphCover = notEnoughData || isLoading;
const showNotEnoughDataText = notEnoughData && !isLoading;
const data = useGraphCover ? placeholderData : aggregateOrProjectData; const data = useGraphCover ? placeholderData : aggregateOrProjectData;
const options = useMemo( const options = useMemo(
@ -229,7 +230,7 @@ export const CreationArchiveChart: FC<ICreationArchiveChartProps> = ({
<CreationArchiveRatioTooltip tooltip={tooltip} /> <CreationArchiveRatioTooltip tooltip={tooltip} />
{useGraphCover ? ( {useGraphCover ? (
<GraphCover> <GraphCover>
{notEnoughData ? <NotEnoughData /> : isLoading} {showNotEnoughDataText ? <NotEnoughData /> : isLoading}
</GraphCover> </GraphCover>
) : null} ) : null}
</> </>