Skip to content

Commit 4135160

Browse files
author
Bart Schuurmans
committed
Improve syntax lookup history behaviour
Use Next.Router.push instead of replace
1 parent dcd5e77 commit 4135160

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

src/SyntaxLookup.mjs

+3-3
Original file line numberDiff line numberDiff line change
@@ -180,16 +180,16 @@ function SyntaxLookup(Props) {
180180
if (match !== undefined) {
181181
var slug = GithubSlugger.slug(item.id);
182182
if (slug !== match) {
183-
Next.Router.replace(router, "syntax-lookup#" + match);
183+
Next.Router.push(router, "syntax-lookup#" + match);
184184
}
185185

186186
} else {
187-
Next.Router.replace(router, "syntax-lookup#" + GithubSlugger.slug(item.id));
187+
Next.Router.push(router, "syntax-lookup#" + GithubSlugger.slug(item.id));
188188
}
189189
}
190190
if (exit === 1) {
191191
if (match !== undefined) {
192-
Next.Router.replace(router, "syntax-lookup");
192+
Next.Router.push(router, "syntax-lookup");
193193
}
194194

195195
}

src/SyntaxLookup.res

+3-3
Original file line numberDiff line numberDiff line change
@@ -185,13 +185,13 @@ let make = () => {
185185
let slug = GithubSlugger.slug(item.id)
186186

187187
if slug !== anchor {
188-
router->Next.Router.replace("syntax-lookup#" ++ anchor)
188+
router->Next.Router.push("syntax-lookup#" ++ anchor)
189189
} else {
190190
()
191191
}
192192
| (ShowDetails(item), None) =>
193-
router->Next.Router.replace("syntax-lookup#" ++ GithubSlugger.slug(item.id))
194-
| (_, Some(_)) => router->Next.Router.replace("syntax-lookup")
193+
router->Next.Router.push("syntax-lookup#" ++ GithubSlugger.slug(item.id))
194+
| (_, Some(_)) => router->Next.Router.push("syntax-lookup")
195195
| _ => ()
196196
}
197197
None

0 commit comments

Comments
 (0)