Skip to content

Commit

Permalink
Fix reload prevention to allow initial temp site creation
Browse files Browse the repository at this point in the history
  • Loading branch information
brandonpayton committed Oct 31, 2024
1 parent 02932bb commit c06b09b
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
setTemporarySiteSpec,
} from '../../lib/state/redux/slice-sites';
import {
selectActiveSite,
setActiveSite,
useAppDispatch,
useAppSelector,
Expand All @@ -33,6 +34,7 @@ export function EnsurePlaygroundSiteIsSelected({
const siteListingStatus = useAppSelector(
(state) => state.sites.loadingState
);
const activeSite = useAppSelector((state) => selectActiveSite(state));
const dispatch = useAppDispatch();
const url = useCurrentUrl();
const requestedSiteSlug = url.searchParams.get('site-slug');
Expand Down Expand Up @@ -90,7 +92,9 @@ export function EnsurePlaygroundSiteIsSelected({
const newParams = new URLSearchParams(url?.search);
oldParams.delete(notRefreshingParam);
newParams.delete(notRefreshingParam);
if (oldParams.toString() === newParams.toString()) {
const avoidUnnecessaryTempSiteReload =
activeSite && oldParams.toString() === newParams.toString();
if (avoidUnnecessaryTempSiteReload) {
return;
}

Expand Down

0 comments on commit c06b09b

Please sign in to comment.