-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RFC: react-map-gl v7.0 #1646
Comments
This sounds like the right move to secure the future of this framework. This should make the code base considerably simpler, and both reduce the burden on current maintainer and make the react-map-gl code more accessible to new maintainers as well as the community. Is it possible to quickly spin up a prototype? Being able to see an alpha release of the new approach work in a major app like kepler.gl would be a big confidence builder.
nebula.gl also has some at least superficially similar overlay components. Perhaps an alignment opportunity? |
I have pushed a proof of concept here: https://github.com/visgl/react-map-gl/tree/prototype Tested with the following use cases:
function App() {
const [viewState, setViewState] = useState({
latitude: 40,
longitude: -100,
zoom: 3.5,
bearing: 0,
pitch: 0
});
return <Map
{...viewState}
onMove={({viewState}) => setViewState(viewState)}
mapStyle="mapbox://styles/mapbox/dark-v9"
/>;
}
function App() {
return <Map
initOptions={{
latitude: 40,
longitude: -100,
zoom: 3.5,
bearing: 0,
pitch: 0
}}
mapStyle="mapbox://styles/mapbox/dark-v9"
/>;
}
function App() {
return <DeckGL
initialViewState={{
latitude: 40,
longitude: -100,
zoom: 3.5,
bearing: 0,
pitch: 0
}}
controller
>
<Map mapStyle="mapbox://styles/mapbox/dark-v9" />
</DeckGL>;
} |
Thanks a lot for the huge work here @Pessimistress. It totally makes sense to me, vis.gl should continue being basemap agnostic. It reduces complexity, it's easy for maintainers, and brings the possibility of getting the features implemented by the new providers. Definitely, a better strategy for the current situation with mapbox-gl. @VictorVelarde we should try this prototype after the Christmas holidays to see how it fits in CARTO products (mainly CARTO for React and Builder) |
You can try the work-in-progress release with Docs: https://github.com/visgl/react-map-gl/tree/7.0-dev/docs/api-reference |
Thanks a lot @Pessimistress. Tried it yesterday and it is already working like a charm! It's faster, it is (way) smaller and less lines of codes are needed for implementing it in our own codebase. 👏 |
Great to see this. Thanks for all the effort @Pessimistress. I have two questions regarding the reversal of control flow (dropping mjolnir):
|
@felixpalmer You can still use DeckGL to control the map, which is the main use case for nebula and all deck.gl examples. It's just that react-map-gl no longer implements a controller. |
Hi @Pessimistress, I have been testing v7 quite extensively. How do you want to receive the feedback? |
@timsluis That's what this thread is for. |
Three things I noticed:
|
Fully support this direction for the project! With the move of The current practice of using a mapbox-gl fork works great for applications, but makes things problematic for users wishing to use I've thought a bit about this before and considered something like dynamic imports that landed in ES2020: // src/utils/mapboxgl.js
export default (await import(config.MAP_LIBRARY ?? 'mapbox-gl')).default; I'm not sure what would be a good API to allow users to set their preferred map library. Any thoughts on this idea? |
@slaymance Thank you for the suggestion. I have opened a PR with a proposed |
Awesome changes, the transition from v6 to v7 was quite seamless for my team. Only issue we are seeing so far is the following:
TL;DR:
The NavigationControl cannot be interacted with via mouse events and if you tab to the controls and active via spacebar / enter it desyncs deckgl from mapbox view state. |
@brandonjpierce there is a section in the RFC that discusses deck.gl support. TLDR is that v7 controls will no longer work with the DeckGL component. |
Apologies, I must have missed that. Thanks for the info! |
Hi! Thanks for the awesome work 👍 |
Thanks to everyone on this thread for your feedback! 7.0.0 has been published. Please open new issues for bugs and feature requests. |
Thanks for the awesome works, @Pessimistress (and other collaborators of course) I haven't tried anything complex but overall I can see the significant performance improved! 🙏🏻 ❤️ |
Thanks for the amazing work @Pessimistress, have been testing this with |
Hello guys! I started using this awesome framework a couple of weeks ago on a legacy project. They started using MapBox and now wanted to change to MapLibre. However, I tried following the tutorial on the react-map-gl website on a brand-new create-react-app project and it is not working. The following error keeps appearing: It seems like it is still looking for mapbox-gl even though as explained on the tutorial, I am passing the maplibre library to the Map using the prop mapLib... Any clues? Thank you very much! (I have not added any more detail about the code as it is failing on a brand-new create-react-app project) Here you have the package.json in case it helps:
|
Have you tried to install mapbox-gl? I don't need to provide any maplibre in my app. |
Thank you very much for your answer!
Yeah, it looks like for some reason the mapbox-gl library was removed from the node_modules (it was installed when I installed react-map-gl. But Isn't the whole point about not using mapbox-gl? In addition, even though now I am not getting that error, I am getting the following error:
I think that this is related to the mapbox token as now I am using a mapbox style but I am passing the token to the initialized map as you can see in the following code snippet:
Again, here is my package.json:
Thank you very much! |
Is there any open project on which they are using maplibre with react-map-gl in order to check what I am doing wrong? Thanks guys! |
@victcebesp, please consider opening a Q&A discussion or a new issue/bug report instead of commenting here. The discussion has been closed a long while ago and a lot of people are subscribed to it. |
Background
react-map-gl was originally created by Uber's visualization team to work with deck.gl. Aside from providing a React-friendly wrapper for Mapbox GL JS, it currently also addresses use cases including:
The project was transferred to the Urban Computing Foundation in April 2020.
Issues with the current code base
Diverged dependencies
react-map-gl currently have two releases in production:
The divergence happened when Mapbox changed its license, see #1380. It has become increasingly difficult to maintain as Maplibre and Mapbox start making more aggressive breaking changes.
Override of the native event handling
react-map-gl disables mapbox-gl's native event handling and implements its own. This is arguably the one most controversial design decision of this project, dated back to before the current maintainers were involved. Lengthy discussions have been had (e.g. #569, mapbox/mapbox-gl-js#3746, #725) and continues to generate hard-to-resolve feature requests (#574, #1640, #1353, #775) and performance issues (#1151, #909).
Despite major efforts to improve the usability of the custom controller, it still has many open issues. The code base is quite complex already, with few developers able to navigate and contribute. Considering the complexity of the task, it is unlikely for the current release to support Mapbox's non-WebMercator projection feature in its current state.
Proposal
This RFC is gathering feedback for the following major breaking changes proposed for react-map-gl v7.
mapbox-gl
a peer dependency so that the library is impartial about the version/fork used.EventManager
and subsequentlyMapController
altogether. Instead, we will pursue exposing mapbox-gl's native event system and attempt to hijack the camera change under the hood.Map.flyTo
andMap.easeTo
.DeckGL
will stop working. I propose we move some of the current code to a new React component library that is independent from mapbox-gl.The goal is to have a code base that is less demanding to maintain, and more focused on the most common use cases. To achieve this, we have to drop some niche use cases and/or move their support to other projects.
The text was updated successfully, but these errors were encountered: