Skip to content

Commit d46a072

Browse files
Ihor DykhtaIhor Dykhta
authored andcommitted
nit
Signed-off-by: Ihor Dykhta <ihordykhta@Ihors-MacBook-Pro.local>
1 parent 28fd0b5 commit d46a072

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

src/utils/src/export-map-html.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -214,8 +214,9 @@ export const exportMapToHTML = (options, version = KEPLER_GL_VERSION) => {
214214
}
215215
216216
/** STORE **/
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.
217+
// Pre-seed styleType so the correct basemap fetch starts on the very
218+
// first render, avoiding a flash of the default dark basemap.
219+
// options.config has the versioned envelope shape: { version, config: { mapStyle, ... } }
219220
const savedStyleType = ${JSON.stringify(options.config?.config?.mapStyle?.styleType ?? null)};
220221
221222
const reducers = (function createReducers(redux, keplerGl, styleType) {
@@ -406,7 +407,11 @@ export const exportMapToHTML = (options, version = KEPLER_GL_VERSION) => {
406407
config
407408
);
408409
409-
// For some reason Kepler overwrites the config without extra wait time
410+
// The 500 ms delay is a historical workaround for a race where
411+
// keplerGl re-initialises and overwrites config applied synchronously.
412+
// The pre-seeded styleType above removes the basemap flash on first
413+
// render; this dispatch still applies the full saved config (layers,
414+
// viewport, layer groups, etc.) once the component has settled.
410415
window.setTimeout(() => {
411416
store.dispatch(
412417
keplerGl.addDataToMap({

0 commit comments

Comments
 (0)