From 1a43a3ffa11bedd4c06ff8a449f98e08a0c74ba8 Mon Sep 17 00:00:00 2001 From: Romain Gauthier Date: Sun, 23 Aug 2026 11:04:20 +0200 Subject: [PATCH] docs(hydrogen): mark the current page in the sample nav MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The nav decided the current page with `page === mainNode`, reference equality on two Graal host proxies, which are never the same object — so aria-current never appeared. JLink compares identifiers. Marking the current page makes the fragment depend on the main resource, which is not part of the cache key unless the view says so, hence cache.mainResource. Refs #759 --- .../src/components/NavBar/default.server.tsx | 20 +++++++++---------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/samples/hydrogen/src/components/NavBar/default.server.tsx b/samples/hydrogen/src/components/NavBar/default.server.tsx index 8e45a40d..52faad19 100644 --- a/samples/hydrogen/src/components/NavBar/default.server.tsx +++ b/samples/hydrogen/src/components/NavBar/default.server.tsx @@ -1,4 +1,4 @@ -import { buildNodeUrl, getChildNodes, jahiaComponent } from "@jahia/javascript-modules-library"; +import { getChildNodes, jahiaComponent, JLink } from "@jahia/javascript-modules-library"; import type { JCRNodeWrapper } from "org.jahia.services.content"; import classes from "./component.module.css"; @@ -11,24 +11,22 @@ jahiaComponent( componentType: "view", nodeType: "hydrogen:navBar", displayName: "NavBar", + // JLink emits aria-current on the page being rendered, which is not part of the fragment + // cache key unless the view says so. Without this the nav would be cached once and replayed, + // marking the same entry current on every page. + properties: { "cache.mainResource": "true" }, }, - (_, { renderContext, mainNode }) => ( + (_, { renderContext }) => (