mapbox / mapbox/mapbox-gl-js

Make Expressions fully deserializable

Open
#6,255 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

refactoring :building_construction:
Dominant language
TypeScript
Stars
12.4k
Forks
2.4k
PR merge metrics
No merged PRs in 30d

Description

Currently, `CompoundExpression#_evaluate` doesn't survive serialization/deserialization via our web worker transfer scheme: https://github.com/mapbox/mapbox-gl-js/blob/f87d7e3401af5902a1d9e6ded2600aa21e4c633f/src/util/web_worker_transfer.js#L101

This was fine until now, because we only evaluate a `{Source,Composite}Binder`'s expression on the worker side, during `populatePaintArray` https://github.com/mapbox/mapbox-gl-js/blob/f87d7e3401af5902a1d9e6ded2600aa21e4c633f/src/data/program_configuration.js#L139

For https://github.com/mapbox/mapbox-gl-js/issues/6020, however, we'll need to evaluate again on the main thread when making updates, and so we should refactor `CompoundExpression` so that it can be fully rehydrated on the main thread.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the web worker transfer scheme in src/util/web_worker_transfer.js and the expression evaluation path in src/data/program_configuration.js, especially populatePaintArray. Trace how CompoundExpression#_evaluate is transferred and identify what must remain available after deserialization. Done means CompoundExpression can be fully rehydrated on the main thread for the update flow described in issue #6020.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
frontend
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.