From 7c12bb1e2003d3776a1aed94528679ec0fef4750 Mon Sep 17 00:00:00 2001 From: sean-brydon <55134778+sean-brydon@users.noreply.github.com> Date: Tue, 26 Apr 2022 01:26:13 +0100 Subject: [PATCH] Bug/i118n flicker (#2609) * Fix Global Flicker * Fixes Flicker + Null return Co-authored-by: Peer Richelsen --- apps/web/lib/QueryCell.tsx | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/apps/web/lib/QueryCell.tsx b/apps/web/lib/QueryCell.tsx index 5c0805ea12..b8f6edd5d1 100644 --- a/apps/web/lib/QueryCell.tsx +++ b/apps/web/lib/QueryCell.tsx @@ -64,7 +64,6 @@ export function QueryCell( opts: QueryCellOptionsNoEmpty | QueryCellOptionsWithEmpty ) { const { query } = opts; - if (query.status === "success") { if ("empty" in opts && (query.data == null || (Array.isArray(query.data) && query.data.length === 0))) { return opts.empty(query); @@ -78,11 +77,13 @@ export function QueryCell( ) ); } + const StatusLoader = opts.customLoader || ; // Fixes edge case where this can return null form query cell + if (query.status === "loading") { - return opts.loading?.(query) ?? opts.customLoader ? opts.customLoader : ; + return opts.loading?.(query) ?? StatusLoader; } if (query.status === "idle") { - return opts.idle?.(query) ?? opts.customLoader ? opts.customLoader : ; + return opts.idle?.(query) ?? StatusLoader; } // impossible state return null;