File tree Expand file tree Collapse file tree 1 file changed +8
-13
lines changed
apps/svelte.dev/src/routes/(authed)/playground/[id]/embed Expand file tree Collapse file tree 1 file changed +8
-13
lines changed Original file line number Diff line number Diff line change 1313 let repl = $state () as ReturnType <typeof Repl >;
1414
1515 let version = page .url .searchParams .get (' version' ) || ' latest' ;
16- let is_pr_or_commit_version = version .startsWith (' pr-' ) || version .startsWith (' commit-' );
17-
18- if (version !== ' local' && ! is_pr_or_commit_version ) {
19- $effect (() => {
20- fetch (` https://cdn.jsdelivr.net/npm/svelte@${version }/package.json ` )
21- .then ((r ) => r .json ())
22- .then ((pkg ) => {
23- if (pkg .version !== data .version ) {
24- replaceState (` /playground/${data .gist .id }/embed?version=${pkg .version } ` , {});
25- }
26- });
27- });
28- }
2916
3017 // TODO make this munging unnecessary
3118 function munge(data : any ): File {
8572 injectedJS ={mapbox_setup }
8673 previewTheme ={theme .current }
8774 embedded ={page .url .searchParams .has (' output-only' ) ? ' output-only' : true }
75+ onversion ={(v ) => {
76+ if (version === v ) return ;
77+
78+ const url = new URL (location .href );
79+ url .searchParams .set (' version' , v );
80+
81+ replaceState (url , {});
82+ }}
8883 />
8984 {/if }
9085</div >
You can’t perform that action at this time.
0 commit comments