Closed Mitsunee closed 2 years ago
Just spent 5h attempting to set up a vite app recreating the issue and it just doesn't want to happen.
Edit: given that the vite app did not have Link
from "next/link"
it could be possible that its use of React.cloneElement
is causing React to not rerender correctly after discovering the static html page.
Edit2: React.cloneElement
is not causing the issue. At least not by itself.
Deployment https://fgo-timers-ooqou9b4s-mitsunee.vercel.app/ has the issue again.
Edit: Removed the conflicting Event to temporarily work around the issue. Will have to investigate solutions for this.
I have tried to make a Mock version of next/link
that merely uses React.cloneElement
to pass the href, which did not result in the bug. Then I also tried to literally copy next/link
(modifying it to not use next/router
) entirely and still could not locally reproduce this bug.
Example Deployments with issue:
The event list desyncs after events (in this case Enma-Tei and Amazones Pre-Campaign) end. In this example it causes the New Years Campaign to appear with the banner image and
href
of Amazones Pre-Campaign, while still having the title of "New Years 2022". Next's Link component still links to the correct place (href
prop ofLink
is updated) despite thehref
of the inner<a>
element being wrong.A temporary workaround is to redeploy as this refreshes the dataset generated by
getStaticProps
. This was not possible here due to an unrelated oversight.Expected Result:
Actual Result:
Steps to reproduce:
See branch reproduce-homepage-bug (specifically files
./pages/index.jsx
and./src/components/EventCard/EventCard.jsx
) for a simulated case of this bug. The branch replaces all static generation related to events with the static data from the 2nd example deployment and usestypeof window === "undefined"
to inject mock timestamps for static generation to cause the event "Amazones Pre-Campaign" to be present during static generation, despite having ended.