File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 3838 }
3939 }
4040
41+ async function syncStudioPrompt() {
42+ if (! browser || resolvedProfile .id !== ProfileMode .STUDIO ) return ;
43+
44+ const currentUrl = new URL (window .location .href );
45+ const promptParam = currentUrl .searchParams .get (' prompt' );
46+
47+ if (promptParam ) {
48+ sessionStorage .setItem (' studioPrompt' , promptParam );
49+ return ;
50+ }
51+
52+ const storedPrompt = sessionStorage .getItem (' studioPrompt' );
53+ if (! storedPrompt ) return ;
54+
55+ currentUrl .searchParams .set (' prompt' , storedPrompt );
56+ await goto (currentUrl .toString (), { replaceState: true , noScroll: true });
57+ sessionStorage .removeItem (' studioPrompt' );
58+ }
59+
4160 onMount (async () => {
4261 updateViewport ();
62+ await syncStudioPrompt ();
4363 // handle sources
4464 if (isCloud ) {
4565 const urlParams = page .url .searchParams ;
116136 });
117137
118138 afterNavigate ((navigation ) => {
139+ syncStudioPrompt ();
119140 if (navigation .type !== ' enter' && navigation .from ?.route ?.id !== navigation .to .route .id ) {
120141 trackPageView (navigation .to .route .id );
121142 }
You can’t perform that action at this time.
0 commit comments