reduce loading rerenders

This commit is contained in:
jackkav 2023-08-17 00:57:28 +02:00
parent 3d4c4dd2d4
commit 7ba00d5ccd

View File

@ -113,7 +113,7 @@ export const Debug: FC = () => {
const [runningRequests, setRunningRequests] = useState<Record<string, boolean>>({});
const setLoading = (isLoading: boolean) => {
invariant(requestId, 'No active request');
if (runningRequests?.[requestId] !== isLoading) {
if (Boolean(runningRequests?.[requestId]) !== isLoading) {
setRunningRequests({
...runningRequests,
[requestId]: isLoading ? true : false,