Skip to content

fix: replace Date.now() with performance.now() in memo debug timing#6196

Open
isaackaara wants to merge 1 commit intoTanStack:mainfrom
isaackaara:fix/replace-date-now-with-performance
Open

fix: replace Date.now() with performance.now() in memo debug timing#6196
isaackaara wants to merge 1 commit intoTanStack:mainfrom
isaackaara:fix/replace-date-now-with-performance

Conversation

@isaackaara
Copy link

Next.js warns about Date.now() usage in client components because it can cause hydration mismatches between server and client renders. While the Date.now() calls in memo() are only used for debug timing and guarded behind opts.debug, Next.js statically detects Date.now() usage and shows the warning regardless.

Switching to performance.now() resolves the Next.js warning and also provides more precise sub-millisecond timing measurements for debug output. The performance.now() API is available in all modern browsers and Node.js 12+, which aligns with the project's engine requirements.

This is a debug-only change with no impact on runtime behavior.

Fixes #6127

Next.js warns about Date.now() usage in client components because it
can cause hydration mismatches between server and client renders.
While the Date.now() calls in memo() are only used for debug timing
and guarded behind opts.debug, Next.js statically detects Date.now()
usage and shows the warning regardless.

Switching to performance.now() resolves the warning and provides
more precise timing measurements for debug output. The
performance.now() API is available in all modern browsers and
Node.js 12+, which aligns with the project's engine requirements.

Fixes TanStack#6127
@changeset-bot
Copy link

changeset-bot bot commented Mar 6, 2026

⚠️ No Changeset found

Latest commit: f6f0240

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 6, 2026

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 5ec9edf6-022f-4b9f-a224-d777a9eb4303

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

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.

1 participant