CityScope / CS_cityscopeJS

Create, design, and publish @CityScope projects on the web
https://cityscope.media.mit.edu/CS_cityscopeJS/
GNU General Public License v3.0
20 stars 16 forks source link

fix test for nested obj on map init #95

Closed RELNO closed 4 years ago

RELNO commented 4 years ago

Fix by @yzheng1998 :

this function checks if the menu has the layer as a way to only load layers existing in this end point

const layerOrder = ["ABM", "AGGREGATED_TRIPS", "GRID", "ACCESS"];
    const _renderLayers = () => {
        let layers = [];
        for (var layer of layerOrder) {
            if (menu.includes(layer)) {
                layers.push(layersKey[layer]);
            }
        }
        return layers;
    };

however,

            data: cityioData.ABM.trips,
            cityioData,
            ABMmode,
            zoomLevel: viewState.zoom,
            sliders,
        }),
        AGGREGATED_TRIPS: AggregatedTripsLayer({
            data: cityioData.ABM.trips,
            cityioData,
            ABMmode,

this type of nested check would break the app, since if there is no cityioDATA.abm, [‘trips’] would not exist