[bug] update_styles on a main's text: instances with overridden text take the main's text width #17

Closed
opened 2026-10-25 06:35:59 +00:00 by masi · 0 comments
Owner

Expected: After changing fontWeight on a main component's fit-content Text, each instance re-measures its own (overridden) text and its hug-width root resizes.
Actual: Instance labels keep/take the width measured from the main's text ("Button"), so instances with longer overridden text overflow or clip ("Confirm order" spills outside a 77px button).
Repro: 1) Main "Btn" = flex row, width fit-content, padding 0 16px, child Text "Label" = "Button", 14px, weight 400. 2) create_instance, set_text_content Label = "Confirm order". 3) update_styles on the main Label {fontWeight:700}. 4) get_node_info on the instance root: width ≈ width of "Button" + 32, text overflows.
Workaround: update_styles {width:"fit-content"} on each instance's Text node forces a re-measure.
Impact: One main edit silently breaks every instance with overridden text across all pages; finding the instance text nodes needs one call per instance.


Filed from PaperCraft 0.7.2 (macos).

**Expected:** After changing fontWeight on a main component's fit-content Text, each instance re-measures its own (overridden) text and its hug-width root resizes. **Actual:** Instance labels keep/take the width measured from the main's text ("Button"), so instances with longer overridden text overflow or clip ("Confirm order" spills outside a 77px button). **Repro:** 1) Main "Btn" = flex row, width fit-content, padding 0 16px, child Text "Label" = "Button", 14px, weight 400. 2) create_instance, set_text_content Label = "Confirm order". 3) update_styles on the main Label {fontWeight:700}. 4) get_node_info on the instance root: width ≈ width of "Button" + 32, text overflows. **Workaround:** update_styles {width:"fit-content"} on each instance's Text node forces a re-measure. **Impact:** One main edit silently breaks every instance with overridden text across all pages; finding the instance text nodes needs one call per instance. --- Filed from PaperCraft 0.7.2 (macos).
masi closed this issue 2026-10-25 06:54:24 +00:00
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: masi/papercraft#17