Skip to content

Commit e78c22b

Browse files
committed
support old hashes
1 parent 8f4c177 commit e78c22b

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

packages/playground/src/app.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { Show, JSX, Suspense } from 'solid-js';
2-
import { Router, Route } from '@solidjs/router';
2+
import { Router, Route, Navigate } from '@solidjs/router';
33
import { eventBus, setEventBus } from './utils/serviceWorker';
44
import { Update } from './components/update';
55
import { useZoom } from 'solid-repl/src/hooks/useZoom';
@@ -27,6 +27,8 @@ export const App = (): JSX.Element => {
2727
}
2828
});
2929

30+
const searchParams = new URLSearchParams(window.location.search);
31+
3032
return (
3133
<div class="dark:bg-solid-darkbg relative flex h-screen flex-col overflow-auto bg-white font-sans text-slate-900 dark:text-slate-50">
3234
<Router
@@ -40,6 +42,9 @@ export const App = (): JSX.Element => {
4042
</Router>
4143

4244
<Show when={eventBus()} children={<Update onDismiss={() => setEventBus(false)} />} />
45+
<Show when={searchParams.has("hash")}>
46+
<Navigate href={`/anonymous/${searchParams.get("hash")}`} />
47+
</Show>
4348
</div>
4449
);
4550
};

packages/playground/src/pages/edit.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,9 @@ export const Edit = () => {
105105
let output: APIRepl;
106106

107107
if (repl) {
108-
output = await fetch(`${API}/repl/${repl}`).then((r) => r.json());
108+
const data = await fetch(`${API}/repl/${repl}`);
109+
output = await data.json();
110+
navigate(`/anonymous/${output.id}`);
109111
} else {
110112
const myScratchpad = localStorage.getItem('scratchpad');
111113
if (!myScratchpad) {

0 commit comments

Comments
 (0)