77 */
88import { Observable } from 'rxjs' ;
99import axios from '../libs/ajax' ;
10- import { get , merge } from 'lodash' ;
10+ import { get , merge , isNaN } from 'lodash' ;
1111import {
1212 LOAD_NEW_MAP ,
1313 LOAD_MAP_CONFIG ,
@@ -61,6 +61,10 @@ const mapFlowWithOverride = (configName, mapId, config, mapInfo, state, override
6161 // certain epics always function correctly
6262 // i.e. FeedbackMask disables correctly after load
6363 // TODO: investigate the root causes of the problem and come up with a better solution, if possible
64+
65+ // mapstore recognizes alphanumeric map id as static json
66+ // avoid map info requests if the configuration is static
67+ const isNumberId = ! isNaN ( parseFloat ( mapId ) ) ;
6468 return (
6569 config ?
6670 Observable . of ( { data : merge ( { } , config , overrideConfig ) , staticConfig : true } ) . delay ( 100 ) :
@@ -77,7 +81,7 @@ const mapFlowWithOverride = (configName, mapId, config, mapInfo, state, override
7781 return Observable . of ( configureError ( { messageId : `map.errors.loading.projectionError` , errorMessageParams : { projection} } , mapId ) ) ;
7882 }
7983 const mapConfig = merge ( { } , response . data , overrideConfig ) ;
80- return mapId ? Observable . of (
84+ return isNumberId ? Observable . of (
8185 configureMap ( mapConfig , mapId ) ,
8286 mapInfo ? mapInfoLoaded ( mapInfo ) : loadMapInfo ( mapId ) ,
8387 ...( response . staticConfig ? [ ] : [ saveMapConfig ( response . data ) ] )
@@ -91,7 +95,7 @@ const mapFlowWithOverride = (configName, mapId, config, mapInfo, state, override
9195 try {
9296 const data = JSON . parse ( response . data ) ;
9397 const mapConfig = merge ( { } , data , overrideConfig ) ;
94- return mapId ? Observable . of ( configureMap ( mapConfig , mapId ) , mapInfo ? mapInfoLoaded ( mapInfo ) : loadMapInfo ( mapId ) ) :
98+ return isNumberId ? Observable . of ( configureMap ( mapConfig , mapId ) , mapInfo ? mapInfoLoaded ( mapInfo ) : loadMapInfo ( mapId ) ) :
9599 Observable . of (
96100 configureMap ( mapConfig , mapId ) ,
97101 ...( mapInfo ? [ mapInfoLoaded ( mapInfo ) ] : [ ] ) ,
0 commit comments