From df17496c69f78bddc401910e93f0276ea4d40053 Mon Sep 17 00:00:00 2001 From: Jackson Harper Date: Fri, 24 Jun 2022 09:15:31 -0700 Subject: [PATCH] Use persisted state instead of preferences data for library layout These visual settings should be per device not set in preferences having them in preferences requires an API call and will make them flicker when loaded. --- .../web/components/templates/homeFeed/HomeFeedContainer.tsx | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/packages/web/components/templates/homeFeed/HomeFeedContainer.tsx b/packages/web/components/templates/homeFeed/HomeFeedContainer.tsx index 5e02fb680..e2c7f75ba 100644 --- a/packages/web/components/templates/homeFeed/HomeFeedContainer.tsx +++ b/packages/web/components/templates/homeFeed/HomeFeedContainer.tsx @@ -502,9 +502,7 @@ function HomeFeedGrid(props: HomeFeedContentProps): JSX.Element { const { preferencesData, isValidating: isValidatingPreferences } = useGetUserPreferences() - const [layout, setLayout] = useState( - (preferencesData?.libraryLayoutType as LayoutType) || 'GRID_LAYOUT' - ) + const [layout, setLayout] = usePersistedState({ key: 'libraryLayout', initialValue: 'GRID_LAYOUT' }) const [showRemoveLinkConfirmation, setShowRemoveLinkConfirmation] = useState(false) const [linkToRemove, setLinkToRemove] = useState()