@@ -214,17 +214,22 @@ export const exportMapToHTML = (options, version = KEPLER_GL_VERSION) => {
214214 }
215215
216216 /** STORE **/
217- const reducers = (function createReducers(redux, keplerGl) {
217+ // Pre-seed the map style so the correct basemap is active from the
218+ // very first render, avoiding a flash of the default dark basemap.
219+ const savedStyleType = ${ JSON . stringify ( options . config ?. config ?. mapStyle ?. styleType ?? null ) } ;
220+
221+ const reducers = (function createReducers(redux, keplerGl, styleType) {
218222 return redux.combineReducers({
219223 // mount keplerGl reducer
220224 keplerGl: keplerGl.keplerGlReducer.initialState({
221225 uiState: {
222226 readOnly: ${ options . mode === EXPORT_HTML_MAP_MODES . READ } ,
223227 currentModal: null
224- }
228+ },
229+ ...(styleType ? {mapStyle: {styleType}} : {})
225230 })
226231 });
227- }(Redux, KeplerGl));
232+ }(Redux, KeplerGl, savedStyleType ));
228233
229234 const middleWares = (function createMiddlewares(keplerGl) {
230235 return keplerGl.enhanceReduxMiddleware([
@@ -237,16 +242,9 @@ export const exportMapToHTML = (options, version = KEPLER_GL_VERSION) => {
237242 }(Redux, middleWares));
238243
239244 const store = (function createStore(redux, enhancers) {
240- // Pre-seed the map style so the correct basemap is active from the
241- // very first render, avoiding a flash of the default dark basemap.
242- const savedStyleType = ${ JSON . stringify ( options . config ?. mapStyle ?. styleType ?? null ) } ;
243- const initialState = savedStyleType
244- ? {keplerGl: {map: {mapStyle: {styleType: savedStyleType}}}}
245- : {};
246-
247245 return redux.createStore(
248246 reducers,
249- initialState ,
247+ {} ,
250248 redux.compose(enhancers)
251249 );
252250 }(Redux, enhancers));
0 commit comments