jackyzha0 / quartz

🌱 a fast, batteries-included static-site generator that transforms Markdown content into fully functional websites
https://quartz.jzhao.xyz
MIT License
6.97k stars 2.48k forks source link

Explorer doesn't refresh page when moving between index.md pages. #1532

Open djotto opened 19 hours ago

djotto commented 19 hours ago

Describe the bug

When Explorer is configured with:

Component.Explorer({
    folderClickBehavior: "link",
})

and you attempt to move between two Folder pages in Explorer, the web browser does not update.

To Reproduce

git clone git@github.com:djotto/quartz.git
cd quartz
npm i
npx quartz build --serve
  1. Navigate to http://localhost:8080
  2. Click "Things"
  3. You will see the text "This page is Things/index.md"
  4. Click "Places"

Actual result: You will see the text "This page is Things/index.md"

Expected result: You will see the text "This page is Places/index.md"

If you click on a Content page (eg Unrelated) between the two folder clicks, you get the correct behaviour. Problem only surfaces when navigating between two Folder pages.

Expected behavior

When clicking between Folder pages in Explorer, the content should update.

Desktop (please complete the following information):

Additional context

The only changes I've made on top of v4 for this bug demo are:

diff --git a/quartz.layout.ts b/quartz.layout.ts
index 4a78256..1742edc 100644
--- a/quartz.layout.ts
+++ b/quartz.layout.ts
@@ -27,7 +27,12 @@ export const defaultContentPageLayout: PageLayout = {
     Component.MobileOnly(Component.Spacer()),
     Component.Search(),
     Component.Darkmode(),
-    Component.DesktopOnly(Component.Explorer()),
+    Component.DesktopOnly(Component.Explorer({
+      folderClickBehavior: "link",
+      filterFn: (node) => {
+        return !["People"].includes(node.name);
+      }
+    })),
   ],
   right: [
     Component.Graph(),
saberzero1 commented 13 hours ago

Thanks for the report. I'll look into it.

saberzero1 commented 12 hours ago

@saberzero1 check folderpage and tagpage behavior regarding filters.

djotto commented 11 hours ago

@saberzero1 I've updated the example to include tag pages. Behaviour also occurs on tag pages.