Demonstrate reactive map navigation, making use of Stimulus Reflex, Cable Ready, Stimulus and Leaflet/Mapbox. The 💡 idea here is that we use the Cable Readyset_dataset_property operation to trigger valueChanged callbacks in the Stimulus controller. We do have to take special care to make sure the callbacks do not fire too often.
A good potential next step would be to debounce the Reflex calls, as scroll wheel zooming tends to get a little busy.
You will require a Mapbox key to be set up in your environment or your Rails credentials:
There is an instance running on Heroku: https://stimulus-reflex-maps.herokuapp.com/
- ensure Postgres and Redis are both running and available on the usual ports
bundleyarnbin/setup- install
MAPBOX_TOKENenvironment variable ormapbox_tokencredential - run
bin/webpack-dev-serverin a terminal window - run
rails sin another terminal window