Skip to content

fix: eliminate props divergence between CoreNode and CoreTextNode#3

Merged
chiefcll merged 1 commit into
mainfrom
claude/fervent-euclid-f463cc
May 8, 2026
Merged

fix: eliminate props divergence between CoreNode and CoreTextNode#3
chiefcll merged 1 commit into
mainfrom
claude/fervent-euclid-f463cc

Conversation

@chiefcll
Copy link
Copy Markdown
Contributor

@chiefcll chiefcll commented May 8, 2026

Summary

  • Fixed a bug where CoreTextNode.textProps and CoreNode.props diverged after setter calls. CoreNode's constructor was field-copying into a new this.props object, while CoreTextNode kept a reference to the original incoming props as this.textProps. After any property setter (e.g. node.color = 0xff0000ff), shared fields like color, x, y on textProps went stale.
  • Removed the redundant object copy in CoreNode's constructor. resolveNodeDefaults already creates a fresh single-use object, so the second allocation was unnecessary. this.props = props directly, with the six setter-managed fields (texture, shader, src, rtt, boundsMargin, scale) destructured before being nulled in-place.
  • Net reduction of ~34 lines and one fewer object allocation per node.

Test plan

  • Verify text nodes reflect color changes after construction (set color via setter, confirm textProps.color matches)
  • Verify texture, shader, src, rtt, boundsMargin still initialize correctly through their setters
  • Run existing test suite
  • Visual regression check on text rendering (both SDF and Canvas paths)

🤖 Generated with Claude Code

CoreNode's constructor was field-copying into a new this.props object,
while CoreTextNode stored a reference to the original props as
this.textProps. After any setter call (e.g. node.color = 0xff0000ff),
this.props and this.textProps diverged — shared fields like color, x, y
on textProps went stale.

Since resolveNodeDefaults already creates a fresh single-use object,
the second copy was redundant. Now this.props = props directly, with
the six setter-managed fields destructured before being nulled in-place
so the setters can re-apply them.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@chiefcll
Copy link
Copy Markdown
Contributor Author

chiefcll commented May 8, 2026

fixes the architectural issue of bug #1

@chiefcll chiefcll merged commit 252a1ba into main May 8, 2026
1 check failed
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