diff --git a/packages/playground/website/src/components/ensure-playground-site/ensure-playground-site-is-selected.tsx b/packages/playground/website/src/components/ensure-playground-site/ensure-playground-site-is-selected.tsx index a4f4a5594d..cee55232a6 100644 --- a/packages/playground/website/src/components/ensure-playground-site/ensure-playground-site-is-selected.tsx +++ b/packages/playground/website/src/components/ensure-playground-site/ensure-playground-site-is-selected.tsx @@ -3,7 +3,7 @@ import { resolveBlueprintFromURL } from '../../lib/state/url/resolve-blueprint-f import { useCurrentUrl } from '../../lib/state/url/router-hooks'; import { opfsSiteStorage } from '../../lib/state/opfs/opfs-site-storage'; import { - siteListingLoaded, + OPFSSitesLoaded, selectSiteBySlug, setTemporarySiteSpec, deriveSiteNameFromSlug, @@ -36,7 +36,7 @@ export function EnsurePlaygroundSiteIsSelected({ children: React.ReactNode; }) { const siteListingStatus = useAppSelector( - (state) => state.sites.loadingState + (state) => state.sites.opfsSitesLoadingState ); const activeSite = useAppSelector((state) => selectActiveSite(state)); const dispatch = useAppDispatch(); @@ -60,14 +60,14 @@ export function EnsurePlaygroundSiteIsSelected({ useEffect(() => { if (!opfsSiteStorage) { logger.error('Error loading sites: OPFS not available'); - dispatch(siteListingLoaded([])); + dispatch(OPFSSitesLoaded([])); return; } opfsSiteStorage.list().then( - (sites) => dispatch(siteListingLoaded(sites)), + (sites) => dispatch(OPFSSitesLoaded(sites)), (error) => { logger.error('Error loading sites:', error); - dispatch(siteListingLoaded([])); + dispatch(OPFSSitesLoaded([])); } ); }, [dispatch]); diff --git a/packages/playground/website/src/components/playground-viewport/index.tsx b/packages/playground/website/src/components/playground-viewport/index.tsx index 6863d2c3ef..2b080a3ea7 100644 --- a/packages/playground/website/src/components/playground-viewport/index.tsx +++ b/packages/playground/website/src/components/playground-viewport/index.tsx @@ -14,12 +14,11 @@ import { SiteError } from '../../lib/state/redux/slice-ui'; import { Button, Spinner } from '@wordpress/components'; import { removeSite, - selectAllSites, selectSiteBySlug, + selectSitesLoaded, selectTemporarySites, } from '../../lib/state/redux/slice-sites'; import classNames from 'classnames'; -import { PlaygroundRoute, redirectTo } from '../../lib/state/url/router'; export const supportedDisplayModes = [ 'browser-full-screen', @@ -59,8 +58,6 @@ export const PlaygroundViewport = ({ * as there's no risk of data loss */ export const KeepAliveTemporarySitesViewport = () => { - const allSites = useAppSelector(selectAllSites); - const temporarySites = useAppSelector(selectTemporarySites); const activeSite = useActiveSite(); const siteSlugsToRender = useMemo(() => { @@ -120,9 +117,7 @@ export const KeepAliveTemporarySitesViewport = () => { ]); }, [siteSlugsToRender]); - const sitesFinishedLoading = useAppSelector((state) => - ['error', 'loaded'].includes(state.sites.loadingState) - ); + const sitesFinishedLoading = useAppSelector(selectSitesLoaded); if (!sitesFinishedLoading) { return (