`data` event from style mutations should be fired synchronously
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 12.4k
- Forks
- 2.4k
- PR merge metrics
- No merged PRs in 30d
Description
Currently, if you mutate the style via `setPaintProperty` or some other runtime styling API, the corresponding `data` event (with `dataType` property equal to `style`) is not fired until the subsequent repaint, which is asynchronous. I think this event should be fired immediately instead:
* The change is observable with respect to `getPaintProperty` or comparable accessor immediately, and it seems like the event should fire as soon as the change becomes observable.
* It's necessary for #2741: `Map` will use the `data` event as the consistent trigger for a new frame, rather than wrapping each `Style` method and calling `_update(true)` manually.
* The current behavior is causing each style mutation to trigger two repaints: one from the manual `_update(true)`, and a second one from the `data` event that's triggered during the first repaint.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing setPaintProperty and the other runtime styling APIs through the Style and Map update paths, then follow where the style data event is dispatched during repaint. Confirm that the event is emitted when the mutation becomes observable and that one style mutation no longer causes two repaints.
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
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100