Repository navigation
fix(react): preserve render profiles for all component names - #2518
Open
kanishksingh01 wants to merge 1 commit into
Open
kanishksingh01 wants to merge 1 commit into
kanishksingh01 wants to merge 1 commit into
Conversation
RENDERS_INIT stores entries in a plain object, so inherited properties are mistaken for existing component records. Use a dictionary without a prototype and execute the embedded scripts in regression tests.
Contributor
|
@kanishksingh01 is attempting to deploy a commit to the Vercel Labs Team on Vercel. A member of the Team first needs to authorize it. |
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.
A React component named
constructor,toString,hasOwnProperty, or__proto__can makereact renderssilently drop the rest of a commit. The profiler indexes a plain object by component name, mistakes an inherited property for an initialized record, and throws at_instances.has. The commit hook catches the exception and returns an incomplete profile.Use a null-prototype dictionary for component records. Add dependency-free Node regression tests that execute the embedded start/stop scripts and verify that both the affected component and its following sibling are recorded. Run these tests in the existing Node CI job.
With a component whose
displayNameisconstructorfollowed by a normal sibling, both component bodies execute once. Before this change the profile reports zero renders; after the change it reports two.Validation
pnpm run test:react-renders: 4 passed; all 4 fail against unchanged main.pnpm run test:launcher: 4 passed.cargo test --locked --manifest-path cli/Cargo.toml native::react -- --test-threads=1: 2 passed.cargo fmt --manifest-path cli/Cargo.toml -- --check: passed.cargo clippy --locked --manifest-path cli/Cargo.toml -- -D warnings: passed.The full Rust suite was not successfully validated locally: an optimized build was killed, and a broader development-profile run showed failures outside the React profiler before being interrupted during repeated browser-launch retries. No Chrome end-to-end run was performed.
Found while investigating #2508. This fixes the component-name collision in the accumulator; #2512 addresses the separate bailout-counting problem.
AI assistance: Codex helped investigate, implement, and validate this change.