Do not create text range for labels of irrelevant nodes
- Dominant language
- TypeScript
- Stars
- 38
- Forks
- 22
- PR merge metrics
- No merged PRs in 30d
Description
### Description
Generating labels can be expensive so it should be deferred until it's able to be displayed. For example...
```xml
```
In this example which is simplified from a real world form, the `/data/note` is not relevant on load, and yet the `/data/concatenated` calculation is executed. This filters a large external secondary instance, and performs the join and concat, but it will never be displayed because it's only relevant when `/data/someid` is not empty which will completely change the filter results.
This evaluation is triggered in two places in the PrimaryInstance. Once when `attached` is set to true which reactively fires `createTextRange`, and once when `setChildren` is called (but I haven't tracked down the reactive graph to work this one out).
Found while working on https://github.com/getodk/web-forms/issues/844
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by tracing PrimaryInstance's attached and setChildren paths, focusing on the reactive calls to createTextRange. Compare the behavior with the irrelevant /data/note example and issue 844. Done means labels for irrelevant nodes do not trigger text-range creation until they can be displayed.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 52/100