mirror of
https://github.com/quartz-community/explorer.git
synced 2026-07-22 02:50:24 +00:00
fix: remove imperative navigation in folder link handler to fix SPA routing
When folderBehavior is 'link', the buttonClickHandler was using window.location.href with a relative URL (e.g. 'features/'), which resolved against the current path and broke navigation between folder pages. Now the handler simply returns, letting the <a> tag's correct absolute href propagate to the SPA router.
This commit is contained in:
parent
cd2b86b64a
commit
9ba62f0f12
1 changed files with 4 additions and 4 deletions
|
|
@ -356,10 +356,10 @@ document.addEventListener("nav", async (e) => {
|
|||
const folderPath = folderContainer.dataset.folderpath;
|
||||
|
||||
if (folderBehavior === "link") {
|
||||
if (folderPath) {
|
||||
const folderHref = simplifySlug(folderPath);
|
||||
window.location.href = folderHref || ".";
|
||||
}
|
||||
// When folderBehavior is "link", the <button> has been replaced with an <a> tag
|
||||
// that has the correct absolute href (e.g. "/features/"). Let the <a> tag's
|
||||
// native click propagate to the SPA router — don't navigate imperatively here,
|
||||
// as that would use a relative URL and break SPA navigation.
|
||||
return;
|
||||
} else {
|
||||
evt.stopPropagation();
|
||||
|
|
|
|||
Loading…
Reference in a new issue