diff --git a/resources/scripts/components/dashboard/DashboardContainer.tsx b/resources/scripts/components/dashboard/DashboardContainer.tsx index b4cb4c290..2edc06056 100644 --- a/resources/scripts/components/dashboard/DashboardContainer.tsx +++ b/resources/scripts/components/dashboard/DashboardContainer.tsx @@ -16,8 +16,9 @@ import Pagination from '@/components/elements/Pagination'; export default () => { const { clearFlashes, clearAndAddHttpError } = useFlash(); const [ page, setPage ] = useState(1); - const { rootAdmin } = useStoreState(state => state.user.data!); - const [ showOnlyAdmin, setShowOnlyAdmin ] = usePersistedState('show_all_servers', false); + const uuid = useStoreState(state => state.user.data!.uuid); + const rootAdmin = useStoreState(state => state.user.data!.rootAdmin); + const [ showOnlyAdmin, setShowOnlyAdmin ] = usePersistedState(`${uuid}:show_all_servers`, false); const { data: servers, error } = useSWR>( [ '/api/client/servers', showOnlyAdmin, page ], diff --git a/resources/scripts/plugins/usePersistedState.ts b/resources/scripts/plugins/usePersistedState.ts index f31985558..007e3fcde 100644 --- a/resources/scripts/plugins/usePersistedState.ts +++ b/resources/scripts/plugins/usePersistedState.ts @@ -1,6 +1,6 @@ import { Dispatch, SetStateAction, useEffect, useState } from 'react'; -export function usePersistedState (key: string, defaultValue: S): [S | undefined, Dispatch>] { +export function usePersistedState (key: string, defaultValue: S): [ S | undefined, Dispatch> ] { const [ state, setState ] = useState( () => { try { @@ -12,7 +12,7 @@ export function usePersistedState (key: string, defaultValue: S): return defaultValue; } - } + }, ); useEffect(() => {