From 6ad4948e42ab60835bb2d1ebccec3520094b7e51 Mon Sep 17 00:00:00 2001 From: Maria Irizarry Date: Thu, 13 Jul 2023 16:24:27 -0700 Subject: [PATCH] fix(pref-v4/list): fix hosted pref page flash on load. (prevent component from un-mounting) --- packages/react-preferences/src/components/PreferenceList.tsx | 2 +- packages/react-preferences/src/components/PreferencesV4.tsx | 4 ---- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/packages/react-preferences/src/components/PreferenceList.tsx b/packages/react-preferences/src/components/PreferenceList.tsx index ccc2c2ac..46de7b8f 100644 --- a/packages/react-preferences/src/components/PreferenceList.tsx +++ b/packages/react-preferences/src/components/PreferenceList.tsx @@ -31,7 +31,7 @@ export const PreferenceList: React.FunctionComponent<{ }, []); const renderPreferences = () => { - if (preferences?.isLoading) { + if (!preferences.preferencePage?.sections?.nodes.length) { return <>; } diff --git a/packages/react-preferences/src/components/PreferencesV4.tsx b/packages/react-preferences/src/components/PreferencesV4.tsx index 61d59950..e2cd906f 100644 --- a/packages/react-preferences/src/components/PreferencesV4.tsx +++ b/packages/react-preferences/src/components/PreferencesV4.tsx @@ -436,10 +436,6 @@ export const PreferencesV4: React.FC<{ accountId?: string; draft?: boolean }> = pullPreferences(); }, []); - if (preferences.isLoading || typeof preferences.isLoading === "undefined") { - return null; - } - if (!preferences.preferencePage && !preferences.isLoading) { return (