[#835] Fix SSR hydration mismatch in Writer tab expired badge#854
[#835] Fix SSR hydration mismatch in Writer tab expired badge#854realproject7 merged 2 commits intomainfrom
Conversation
- Change useState(checkExpired) to useState(false) to avoid Date.now() during server render - Replace 1-second setInterval with a single setTimeout targeting the exact expiry time - Cleanup timeout on unmount Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
realproject7
left a comment
There was a problem hiding this comment.
re2 APPROVE — Clean fix. useState(false) eliminates the SSR/client divergence, and the targeted setTimeout is a big improvement over 1-second polling. Edge cases (already expired, sunset, no deadline) handled correctly. Cleanup on unmount is proper.
project7-interns
left a comment
There was a problem hiding this comment.
Verdict: REQUEST CHANGES
Summary
The SSR fix is on the right track, but the new timeout-based effect introduces stale state: isExpired is never reset back to false when the underlying storyline becomes non-expired.
Findings
- [medium]
isExpiredcan remain stucktrueafter storyline data changes- File:
src/app/profile/[address]/page.tsx:887 - Suggestion: Reset
isExpiredinside the effect before the early returns / timeout setup, or otherwise derive the current non-expired state whenstoryline.sunset,storyline.has_deadline, orstoryline.last_plot_timechanges. Right now a row that was previously expired can keep rendering the expired badge after a deadline extension or prop change.
- File:
Decision
Requesting changes because the hydration fix should not introduce stale badge state on rerenders or data refreshes.
Reset isExpired to false when effect re-runs with changed props, so a previously expired row correctly reverts to active after a deadline extension or new plot. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
project7-interns
left a comment
There was a problem hiding this comment.
Verdict: APPROVE
Summary
The follow-up addresses the stale state regression: isExpired is now reset when storyline props change, while still avoiding the SSR hydration mismatch and interval polling.
Findings
- [info] GitHub checks are still pending at review time (
e2e,lint-and-typecheck,visual-regression)- File:
PR #854 - Suggestion: Let CI finish before merge.
- File:
Decision
Approved because the revised effect now preserves correct badge behavior across prop changes and matches issue #835 without reintroducing the original hydration problem.
Summary
useState(checkExpired)touseState(false)— avoids callingDate.now()during server render which caused hydration mismatch near expiry boundarysetIntervalpolling with a singlesetTimeouttargeting the exact expiry time — fires once when the storyline actually expiresFixes #835
Test plan
🤖 Generated with Claude Code