Created
December 4, 2024 17:16
-
-
Save akirk/fbf7f0fedcd6032bb143cb71eb0cd2c4 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git i/packages/playground/data-liberation/blueprints-library w/packages/playground/data-liberation/blueprints-library | |
index 32b937d7..d7b184aa 160000 | |
--- i/packages/playground/data-liberation/blueprints-library | |
+++ w/packages/playground/data-liberation/blueprints-library | |
@@ -1 +1 @@ | |
-Subproject commit 32b937d775b3df72997393b81efa068370ec81ca | |
+Subproject commit d7b184aa514bfde2ada499c78e9b7a54ba4352b2 | |
diff --git i/packages/playground/website/src/components/ensure-playground-site/ensure-playground-site-is-selected.tsx w/packages/playground/website/src/components/ensure-playground-site/ensure-playground-site-is-selected.tsx | |
index 9d8cc329..b315d232 100644 | |
--- i/packages/playground/website/src/components/ensure-playground-site/ensure-playground-site-is-selected.tsx | |
+++ w/packages/playground/website/src/components/ensure-playground-site/ensure-playground-site-is-selected.tsx | |
@@ -2,6 +2,7 @@ import { useEffect } from 'react'; | |
import { resolveBlueprintFromURL } from '../../lib/state/url/resolve-blueprint-from-url'; | |
import { useCurrentUrl } from '../../lib/state/url/router-hooks'; | |
import { opfsSiteStorage } from '../../lib/state/opfs/opfs-site-storage'; | |
+import { persistTemporarySite } from '../../lib/state/redux/persist-temporary-site'; | |
import { | |
siteListingLoaded, | |
selectSiteBySlug, | |
@@ -69,19 +70,7 @@ export function EnsurePlaygroundSiteIsSelected({ | |
} | |
// If the site slug is provided, try to load the site. | |
- if (requestedSiteSlug) { | |
- // If the site does not exist, redirect to a new temporary site. | |
- if (!requestedSiteObject) { | |
- // @TODO: Notification: 'The requested site was not found. Redirecting to a new temporary site.' | |
- logger.log( | |
- 'The requested site was not found. Redirecting to a new temporary site.' | |
- ); | |
- const currentUrl = new URL(window.location.href); | |
- currentUrl.searchParams.delete('site-slug'); | |
- redirectTo(currentUrl.toString()); | |
- return; | |
- } | |
- | |
+ if (requestedSiteSlug && requestedSiteObject) { | |
dispatch(setActiveSite(requestedSiteSlug)); | |
return; | |
} | |
@@ -108,19 +97,28 @@ export function EnsurePlaygroundSiteIsSelected({ | |
} catch (e) { | |
logger.error('Error resolving blueprint:', e); | |
} | |
+ | |
+ const metadata = { | |
+ originalBlueprint: blueprint, | |
+ }; | |
+ if ( requestedSiteSlug ) { | |
+ metadata.name = requestedSiteSlug; | |
+ } | |
+ | |
// Create a new site otherwise | |
const newSiteInfo = await dispatch( | |
setTemporarySiteSpec({ | |
- metadata: { | |
- originalBlueprint: blueprint, | |
- }, | |
+ metadata, | |
originalUrlParams: { | |
searchParams: parseSearchParams(newUrl.searchParams), | |
hash: newUrl.hash, | |
}, | |
}) | |
); | |
- dispatch(setActiveSite(newSiteInfo.slug)); | |
+ await dispatch(setActiveSite(newSiteInfo.slug)); | |
+ if ( requestedSiteSlug ) { | |
+ dispatch(persistTemporarySite(requestedSiteSlug, 'opfs')); | |
+ } | |
} | |
ensureSiteIsSelected(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment