How to delay MapBox loading until its data sources (DB and JS) are executed?

Hi -
I have a simple MapBox component displaying lines from a database.
The structure is as such:
Mysql query -> JS that converts the DB results into GeoJSON -> Mapbox component that uses that GeoJSON

I have a few params on the page and a refresh button that runs the queries, but I would like the initial app-load to show the data for the default parameters.
The Mysql query is set to run on page load, and has an on-success action that triggers the JS.

My challenge is on initial app load, my MapBox component is unhappy as it appears it has no data to work with:
Error:m is null mapboxMap1 in mapboxMap1

The app is public here -
if anyone can see and enlighten me :slight_smile:


Hi @Mike_Green Thanks for reaching out! It looks like you can solve this by adding some default value to load before the GeoJSON data is available:

Since you mentioned wanting to use the default params, you could replace {} in my example with the default you want to use