Link activeClassName does not work, even with trailing slashes correct #38441
Labels
status: triage needed
Issue or pull request that need to be triaged and assigned to a reviewer
type: bug
An issue or pull request relating to a bug in Gatsby
Preliminary Checks
Description
Hello!
I'm having the same issue as described in #32140, including the
aria-current
mismatch. However, in my case, this is not related to trailing slashes. In mygatsby-node
file. I have verified that the server url is the same as theto
field in theLink
component by logging therouterElement
inssr-develop-static-entry.js
which gives in my case/nl/fotoproducten/
:The
to
field of my link component is:Both are identical. Also in gatsby-node, I have this in the createPage:
So the
path
isurl
which is also in the context, and I then verified if thisurl
in the context is the same as in the gatsby link, which it is. Actually, when I put theurl
from the context into theto
field, it still doesn't apply the active class on page load.When I reload the page the active style is not applied, when I then client side route somewhere and back to this page the active style is correctly applied.
Also, we're not using the offline plugin (which was mentioned in that issue).
I'm not sure how I can further debug why the active style class is not applied. Can I add some other logs? I tried to log the
htmlStr
where it rendered all thea
elements but not with thearia-current
attribute.Reproduction Link
Steps to Reproduce
see above
Expected Result
the active class should be applied on page load during SSR
Actual Result
it is not
Environment
Config Flags
DEV_SSR: true
The text was updated successfully, but these errors were encountered: