mirror of
https://github.com/bitsocialnet/5chan.git
synced 2026-08-03 07:41:04 +02:00
perf(popular-threads): show board-count loading state for popular threads
This commit is contained in:
@@ -139,4 +139,12 @@ describe('use-state-string', () => {
|
||||
|
||||
expect(latestValue).toBe('Resolving 2 addresses from ens.example.com, downloading 2 boards, 1 threads, 1 page from gateway.example.com, ipfs.io');
|
||||
});
|
||||
|
||||
it('shows an immediate board-specific loading string before detailed multi-board states arrive', () => {
|
||||
act(() => {
|
||||
root.render(createElement(FeedStateStringHarness, { addresses: ['music-posting.eth', 'tech-posting.eth'] }));
|
||||
});
|
||||
|
||||
expect(latestValue).toBe('Downloading 2 boards');
|
||||
});
|
||||
});
|
||||
|
||||
@@ -157,12 +157,16 @@ export const useFeedStateString = (subplebbitAddresses?: string[]): string | und
|
||||
}
|
||||
}
|
||||
|
||||
if (!stateString && subplebbitAddresses?.length) {
|
||||
stateString = `downloading ${subplebbitAddresses.length} boards`;
|
||||
}
|
||||
|
||||
// capitalize first letter
|
||||
stateString = stateString.charAt(0).toUpperCase() + stateString.slice(1);
|
||||
|
||||
// if string is empty, return undefined instead
|
||||
return stateString === '' ? undefined : stateString;
|
||||
}, [states, subplebbitAddress]);
|
||||
}, [states, subplebbitAddress, subplebbitAddresses]);
|
||||
|
||||
if (singleSubplebbitFeedStateString) {
|
||||
return singleSubplebbitFeedStateString;
|
||||
|
||||
Reference in New Issue
Block a user