Skip to content

emit a textCalculated before a text might actually be loaded. - #905

Merged
jfboeve merged 2 commits into
mainfrom
feat/text-calculated-event
Sep 18, 2026
Merged

jfboeve merged 2 commits into
mainfrom
feat/text-calculated-event

Conversation

@jfboeve

@jfboeve jfboeve commented Sep 18, 2026

Copy link
Copy Markdown
Collaborator

No description provided.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Preserve layout invalidation when textCalculated listeners modify layout properties.

Get a fresh assessment by requesting another Copilot review.

Pull request overview

Adds a synchronous textCalculated event before the deferred text-loaded event.

Changes:

  • Simplifies TextConstraint enum syntax.
  • Emits calculated text dimensions earlier.

A moderate issue remains: listener-driven layout changes can be overwritten by the later _layoutGenerated assignment, leaving stale layout data.

File summaries
File Summary
src/core/CoreTextNode.ts Updates constraint syntax and adds the textCalculated event.
Review details

Suppressed comments (2)

src/core/CoreTextNode.ts:343

  • Node dimension payloads use the shared Dimensions shape with w/h (the v3 migration docs explicitly mark width/height as unavailable). This event therefore returns undefined to consumers reading payload.dimensions.w or .h, unlike the following loaded event. Emit the established keys here as well.
      dimensions: {
        width,
        height,
      },

src/core/CoreTextNode.ts:338

  • Please add a regression test for both renderer paths that asserts textCalculated is emitted before loaded and carries the calculated dimensions. The existing CoreTextNode tests cover rendering and loaded behavior, but do not exercise this new event, so its ordering and payload can regress unnoticed.
    this.emit('textCalculated', {
  • Files reviewed: 1/1 changed files
  • Comments generated: 1
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/core/CoreTextNode.ts Outdated
Comment thread src/core/CoreTextNode.ts Outdated
@jfboeve
jfboeve merged commit d79ec15 into main Sep 18, 2026
4 checks passed
@jfboeve
jfboeve deleted the feat/text-calculated-event branch September 18, 2026 13:32
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.

3 participants