Refactor "GeoJSONSource" as a composition "VectorTileSource"
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 12.4k
- Forks
- 2.4k
- PR merge metrics
- No merged PRs in 30d
Description
See the instructions in [this comment](https://github.com/mapbox/mapbox-gl-js/pull/2918#issuecomment-241714024) for a description of what would currently be required to create a custom variation of `VectorTileSource`.
On the worker side, it's not bad at all: `VectorTileWorkerSource` is designed to accept a custom `loadVectorTile` in its constructor. But on the main thread, the whole `VectorTileSource` has to be forked in order to add a `type: 'my-custom-source-type-name'` property to any params sent to the worker (so that messages go to the custom worker source rather than the core VectorTileWorkerSource).
If `VectorTileSource` just kept a `this.type` property from its constructor options and sent it along in all its worker requests, this would simplify a custom source author's job significantly.
cc @lucaswoj
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 with the linked pull request comment, then inspect VectorTileSource and VectorTileWorkerSource to understand how worker requests select a source. The refactor is complete when a custom source can provide its type through worker requests without forking VectorTileSource; identify or add coverage for that behavior if the existing tests expose these entry points.
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