prismicio / prismic-next

Helpers to integrate Prismic into Next.js apps
https://prismic.io/docs/technologies/nextjs
Apache License 2.0
56 stars 7 forks source link

Forwarded ref in `PrismicNextLink` breaks `basePath` #93

Open DiemasMichiels opened 7 months ago

DiemasMichiels commented 7 months ago

Pages router

Using PrismicNextLink with basePath throws the following hydration error:

Warning: Prop `href` did not match. Server: "/article/my-article" Client: "/home/article/my-article/"

Resulting in an issue where the link can be wrong displayed. Looking into the issue, I copied the exact PrismicNextLink file from here and tried with that. Removing the forwarded ref resolved the issue for basePath and the / at the end.

Versions

Steps to reproduce

What is expected?

The error should not be thrown with or without basePath.

What is actually happening?

An error is thrown, and the path is sometimes incorrect.

github-actions[bot] commented 7 months ago

This issue has been labeled as a bug since it was created using the 🚨 Bug Report Template.

Hi there, thank you so much for the report!

Following our Maintenance Process, we will review your bug report and get back to you next Wednesday. To ensure a smooth review of your issue and avoid unnecessary delays, please make sure your issue includes the following:

If you have identified the cause of the bug described in your report and know how to fix it, you're more than welcome to open a pull request address it. Check out our quick start guide for a simple contribution process.

If you think your issue is a question (not a bug) and would like quicker support, please close this issue and forward it to an appropriate section on our community forum: https://community.prismic.io

- The Prismic Open-Source Team