Repository navigation
Conversation
…rning The re-render warning used to fire whenever two updates happened within 60ms, which caused false positives on mount under React StrictMode (memo replays) and for props that genuinely change quickly, while missing inline props on slower re-renders. It now warns when a prop receives a new value with identical content (deep comparison, functions compared by source) on consecutive updates, names only the offending props, warns once per prop, and suggests how to fix it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The comparison and message helpers lived at module level and were exported, so minifiers could not drop them when __DEV__ is false. They now live inside the dev-only branch, and the production build of the hook is just a no-op. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The dev-only re-render warning (
useProfiler) fired whenever two updates of a watched prop happened within 60ms. In practice:useMemois replayed with identical inputs, so apps saw a burst of warnings at startup ("last update was 0.00ms ago") forTRenderEngineProvider,remoteErrorView or remoteLoadingView,renderersandrenderersProps.baseStylethat really changes quickly.tagsStylesrebuilds the engine on every render but never triggered the warning.TRenderEngineProvider), gave no fix, and logged on every fast update.Change
Timing no longer matters. The hook now receives the values it watches and warns when a prop gets a new reference with identical content on two consecutive updates. That is the signature of an object, array or function created inline during render.
Content is compared deeply for plain objects and arrays, functions are compared by source, and class instances are compared by reference. Depth is capped, so cyclic values are safe.
Calls with unchanged references (StrictMode replays) are ignored.
Only the offending props are named, and each prop warns once per component instance.
The message explains the cause and the fix:
All five call sites (
TRenderEngineProviderconfig,renderers,renderersProps,remoteErrorView/remoteLoadingView,onDocumentMetadataLoaded/onTTreeChange) now pass their values. The FAQ troubleshooting heading is updated to match the new wording.Tests
New
src/hooks/__tests__/useProfiler.test.tsx(13 tests) covers the equality helper, the hook, andRenderHTMLunder StrictMode: no warnings on mount with inline props, one warning for an inlinetagsStylesacross re-renders, and none for stable or genuinely changing props. Against the old implementation, the StrictMode mount test reproduces the startup warnings.jest src/: 278 passedeslint src/: cleantsc --noEmit: no errors in the changed files. Locally, the package-wide type check fails on unrelatedCannot find module '@native-html/transient-render-engine'errors because that workspace package isn't built.🤖 Generated with Claude Code