fix: replace Date.now() with performance.now() in memo debug timing by isaackaara · Pull Request #6196 · TanStack/table · GitHub
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
Copy Markdown

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
Copy Markdown

changeset-bot Bot commented Mar 6, 2026

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Mar 6, 2026

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