Skip to content

Conversation

@jakebayliss
Copy link
Member

We are getting hammered by hydration mismatch browser exceptions - about 2 million in the last 30 days causing spikes in Azure spend. After investigation this is likely due to not setting our dates inside react useEffects.

image

…ide. Moving Date calculations to useState/useEffect
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR addresses hydration mismatch issues causing excessive Azure costs by moving client-side date calculations into React useEffect hooks. The changes prevent server-client rendering discrepancies for time-based content.

  • Wraps date formatting logic in useEffect hooks to execute only on client-side
  • Adds suppressHydrationWarning attributes to components displaying relative time
  • Moves year calculation to build-time to avoid runtime hydration mismatches

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
src/templates/rule.js Conditionally renders relative time only on client-side with hydration warning suppression
src/components/latest-rules-content/latestRulesContent.js Converts FormatDate to stateful component with useEffect for client-side time calculations
src/components/footer/footer.js Moves deploy time calculation to useEffect and year calculation to build-time

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants