Do not throw when an ESM script has attribute data but no schema - #9204
Merged
Conversation
Build size reportThis PR changes the size of the minified bundles.
|
mvaligursky
commented
Aug 20, 2026
mvaligursky
left a comment
Contributor
Author
There was a problem hiding this comment.
Automated PR review by Codex (GPT-5).
No actionable issues found.
The early return matches the existing warning contract and is required outside debug builds as well, where the Debug call is stripped but the schema dereference would otherwise remain. It leaves the script instance usable, avoids fabricating an attribute layout without a schema, and preserves the stored raw data should initialization be retried after a schema is supplied.
Local verification on the exact head: the full focused ScriptComponent suite passed (89 tests), ESLint passed for both changed files, and git diff --check passed. All current GitHub checks are green.
mvaligursky
force-pushed
the
mv-script-attributes-no-schema
branch
from
August 21, 2026 10:09
952ebdd to
b230b0c
Compare
`initializeAttributes` warns that a schema is required for the data to be instantiated, then falls straight through to `schema.attributes` and throws `TypeError: Cannot read properties of undefined (reading 'attributes')`. So creating a Script class with attribute data but no registered schema throws out of `ScriptComponent#create` instead of just warning. Return after the warning, which is what the message already says happens. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
mvaligursky
force-pushed
the
mv-script-attributes-no-schema
branch
from
August 21, 2026 10:13
b230b0c to
27e7884
Compare
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.
Description
ScriptComponent#initializeAttributeswarns that a schema is required for the data to be instantiated, then falls straight through and dereferences it anyway:So creating a
Scriptclass with attribute data but no registered schema throwsTypeError: Cannot read properties of undefined (reading 'attributes')out ofScriptComponent#create, rather than just warning:Return after the warning, which is what the message already says happens. Note the
Debugcall is stripped from release builds while the dereference is not, so the throw is there in both.Found while writing tests for #9203, unrelated to the clone path.
Testing
One test in
test/framework/components/script/component.test.mjs, fails onmain: creating aScriptwith attribute data and no schema warns, does not throw, and leaves the script instance usable with no attributes assigned.Checklist
🤖 Generated with Claude Code