Skip to content
Snippets Groups Projects
Unverified Commit 1568e586 authored by Tom Robinson's avatar Tom Robinson
Browse files

Preserve hash when redirecting from /q -> /question and /card/:cardId ->...

Preserve hash when redirecting from /q -> /question and /card/:cardId -> /question/:cardId. Resolves #4799
parent 5778d5d9
No related branches found
No related tags found
No related merge requests found
......@@ -271,8 +271,9 @@ export const getRoutes = (store) =>
</Route>
{/* DEPRECATED */}
<Redirect from="/q" to="/question" />
<Redirect from="/card/:cardId" to="/question/:cardId" />
{/* NOTE: these custom routes are needed because <Redirect> doesn't preserve the hash */}
<Route path="/q" onEnter={({ location }, replace) => replace({ pathname: "/question", hash: location.hash })} />
<Route path="/card/:cardId" onEnter={({ location, params }, replace) => replace({ pathname: `/question/${params.cardId}`, hash: location.hash })} />
<Redirect from="/dash/:dashboardId" to="/dashboard/:dashboardId" />
{/* MISC */}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment