adobe / adobe/balance-text

How to avoid crash on component change?

Open
#156 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
1.4k
Forks
77
PR merge metrics
No merged PRs in 30d

Description

This is more of a question than an issue but I was not sure where else to post.

I enabled text balancing on a React component whose content can change based on its props. Due to how the props are computed, the content of the component changes when it is mounted. Due to JS event scheduling, the component content changes as the balance-text library is trying to balance the text, leading to `window.getComputedStyle()` to error out as the element is gone, and `removeChild()` to also error out.

Any suggestions on how to work around this problem? (which I admit is not really an issue with the library)

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the React component's prop-driven content change while balance-text is running. Observe the window.getComputedStyle() and removeChild() failures; done means the component can change content during mounting without either crash.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, react
Domain
frontend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.