File tree Expand file tree Collapse file tree 1 file changed +6
-5
lines changed
Expand file tree Collapse file tree 1 file changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -46,7 +46,11 @@ export async function onPageLoad() {
4646 const navigate = useNavigate ( ) ;
4747 const stateUrl = location . query . s ;
4848 if ( stateUrl ) {
49- return await loadStateFromURL ( stateUrl ) ;
49+ await loadStateFromURL ( stateUrl ) ;
50+ // Remove query parameter after loading state from URL,
51+ // as after editing the experiment the URL gets out of sync
52+ navigate ( "/" ) ;
53+ return ;
5054 }
5155 const presetUrl = location . query . preset ;
5256 if ( presetUrl ) {
@@ -118,8 +122,7 @@ export function saveToLocalStorage() {
118122}
119123
120124async function loadStateFromURL ( url : string ) {
121- const navigate = useNavigate ( ) ;
122- showToastPromise (
125+ await showToastPromise (
123126 async ( ) => {
124127 const response = await fetch ( url ) ;
125128 if ( ! response . ok ) {
@@ -129,8 +132,6 @@ async function loadStateFromURL(url: string) {
129132 }
130133 const rawData = await response . text ( ) ;
131134 await loadStateFromString ( rawData ) ;
132- // clear ?e from URL after loading, as any edits would make URL a lie
133- navigate ( "/" ) ;
134135 } ,
135136 {
136137 loading : "Loading experiment from URL..." ,
You can’t perform that action at this time.
0 commit comments