Skip to content

Commit 7392ac9

Browse files
authored
[Backport 3.3.x][Fixes #756] Timing issues with timeline histogram initialization (#761)
* include epics needed for timeline at app initialization * update client bundle
1 parent 1cf0b71 commit 7392ac9

300 files changed

Lines changed: 160 additions & 137 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

geonode_mapstore_client/client/js/apps/gn-dashboard.js

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@ import {
3939
setupConfiguration,
4040
getVersion,
4141
initializeApp,
42-
getPluginsConfiguration
42+
getPluginsConfiguration,
43+
storeEpicsCache
4344
} from '@js/utils/AppUtils';
4445
import pluginsDefinition from '@js/plugins/index';
4546
import ReactSwipe from 'react-swipeable-views';
@@ -87,6 +88,16 @@ document.addEventListener('DOMContentLoaded', function() {
8788
permissions
8889
} = setupConfiguration({ localConfig, user });
8990

91+
const appEpics = {
92+
...configEpics,
93+
// epics related to dashboard are imported at root levele
94+
// because of the use of initial action
95+
// in particular `dashboardLoaded`
96+
...widgetsEpics,
97+
...dashboardEpics
98+
};
99+
storeEpicsCache(appEpics);
100+
90101
main({
91102
targetId,
92103
appComponent: withRoutes(routes)(ConnectedRouter),
@@ -125,14 +136,7 @@ document.addEventListener('DOMContentLoaded', function() {
125136
maptype,
126137
widgets
127138
},
128-
appEpics: {
129-
...configEpics,
130-
// epics related to dashboard are imported at root levele
131-
// because of the use of initial action
132-
// in particular `dashboardLoaded`
133-
...widgetsEpics,
134-
...dashboardEpics
135-
},
139+
appEpics,
136140
onStoreInit,
137141
initialActions: [
138142
// add some settings in the global state to make them accessible in the monitor state

geonode_mapstore_client/client/js/apps/gn-geostory.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@ import {
3636
setupConfiguration,
3737
getVersion,
3838
initializeApp,
39-
getPluginsConfiguration
39+
getPluginsConfiguration,
40+
storeEpicsCache
4041
} from '@js/utils/AppUtils';
4142
import pluginsDefinition from '@js/plugins/index';
4243
import ReactSwipe from 'react-swipeable-views';
@@ -147,6 +148,10 @@ document.addEventListener('DOMContentLoaded', function() {
147148
}
148149
: geoNodePageConfig.resourceConfig;
149150

151+
const appEpics = {
152+
...configEpics
153+
};
154+
storeEpicsCache(appEpics);
150155
main({
151156
targetId,
152157
appComponent: withRoutes(routes)(ConnectedRouter),
@@ -197,9 +202,7 @@ document.addEventListener('DOMContentLoaded', function() {
197202
security,
198203
maptype
199204
},
200-
appEpics: {
201-
...configEpics
202-
},
205+
appEpics,
203206
onStoreInit,
204207
initialActions: [
205208
// add some settings in the global state to make them accessible in the monitor state

geonode_mapstore_client/client/js/apps/gn-map.js

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,8 @@ import {
4848
setupConfiguration,
4949
getVersion,
5050
initializeApp,
51-
getPluginsConfiguration
51+
getPluginsConfiguration,
52+
storeEpicsCache
5253
} from '@js/utils/AppUtils';
5354

5455
import {
@@ -62,6 +63,7 @@ import {
6263
gnCheckSelectedLayerPermissions,
6364
gnSetLayersPermissions
6465
} from '@js/epics';
66+
import timelineEpics from '@mapstore/framework/epics/timeline';
6567
import maplayout from '@mapstore/framework/reducers/maplayout';
6668
import 'react-widgets/dist/css/react-widgets.css';
6769
import 'react-select/dist/react-select.css';
@@ -115,6 +117,18 @@ document.addEventListener('DOMContentLoaded', function() {
115117
const mapLayout = getConfigProp('mapLayout') || {};
116118
setConfigProp('mapLayout', mapLayout[query.theme] || mapLayout[pluginsConfigKey] || mapLayout.viewer);
117119

120+
const appEpics = {
121+
...standardEpics,
122+
...configEpics,
123+
updateMapLayoutEpic,
124+
gnCheckSelectedLayerPermissions,
125+
gnSetLayersPermissions,
126+
...pluginsDefinition.epics,
127+
// needed to initialize the correct time range
128+
...timelineEpics
129+
};
130+
131+
storeEpicsCache(appEpics);
118132
// register custom arcgis layer
119133
import('@js/components/' + mapType + '/ArcGisMapServer')
120134
.then(() => {
@@ -178,14 +192,7 @@ document.addEventListener('DOMContentLoaded', function() {
178192
annotations,
179193
...pluginsDefinition.reducers
180194
},
181-
appEpics: {
182-
...standardEpics,
183-
...configEpics,
184-
updateMapLayoutEpic,
185-
gnCheckSelectedLayerPermissions,
186-
gnSetLayersPermissions,
187-
...pluginsDefinition.epics
188-
},
195+
appEpics,
189196
initialActions: [
190197
// add some settings in the global state to make them accessible in the monitor state
191198
// later we could use expression in localConfig

geonode_mapstore_client/client/js/hooks/useLazyPlugins.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import isEmpty from 'lodash/isEmpty';
1111
import { getPlugins, createPlugin, isMapStorePlugin } from '@mapstore/framework/utils/PluginsUtils';
1212
import { augmentStore } from '@mapstore/framework/utils/StateUtils';
1313
import join from 'lodash/join';
14+
import { getEpicCache, setEpicCache } from '@js/utils/AppUtils';
1415

1516
function filterRemoved(registry, removed = []) {
1617
return Object.keys(registry).reduce((acc, p) => {
@@ -26,7 +27,6 @@ function filterRemoved(registry, removed = []) {
2627

2728
let storedPlugins = {};
2829
const pluginsCache = {};
29-
const epicsCache = {};
3030
const reducersCache = {};
3131

3232
function useLazyPlugins({
@@ -78,10 +78,10 @@ function useLazyPlugins({
7878
// so we need to filter out the one previously added and include only new one
7979
const filterOutExistingEpics = Object.keys(epics)
8080
.reduce((acc, key) => {
81-
if (epicsCache[key]) {
81+
if (getEpicCache(key)) {
8282
return acc;
8383
}
84-
epicsCache[key] = true;
84+
setEpicCache(key);
8585
return {
8686
...acc,
8787
[key]: epics[key]

geonode_mapstore_client/client/js/utils/AppUtils.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,18 @@ import isString from 'lodash/isString';
2828
import url from 'url';
2929
import axios from '@mapstore/framework/libs/ajax';
3030

31+
let epicsCache = {};
3132
let actionListeners = {};
3233

34+
export const storeEpicsCache = (epics) => {
35+
Object.keys(epics).forEach((key) => {
36+
epicsCache[key] = true;
37+
});
38+
};
39+
40+
export const getEpicCache = (name) => epicsCache[name];
41+
export const setEpicCache = (name) => { epicsCache[name] = true; };
42+
3343
export function getVersion() {
3444
if (!__DEVTOOLS__) {
3545
return __MAPSTORE_PROJECT_CONFIG__.version;
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
geonode-mapstore-client-v3.3.0-2ac0b447edf34d25283fd67ffbdcc3f0d8082b73
1+
geonode-mapstore-client-v3.3.0-91f1e52b3b182838c3e9d304be9e3a7afac70942

geonode_mapstore_client/static/mapstore/dist/js/1058.251757fe2c4f7ecbe130.chunk.js renamed to geonode_mapstore_client/static/mapstore/dist/js/1058.5f05167896fc17243fd2.chunk.js

File renamed without changes.

geonode_mapstore_client/static/mapstore/dist/js/1167.251757fe2c4f7ecbe130.chunk.js renamed to geonode_mapstore_client/static/mapstore/dist/js/1167.5f05167896fc17243fd2.chunk.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

geonode_mapstore_client/static/mapstore/dist/js/1167.251757fe2c4f7ecbe130.chunk.js.LICENSE.txt renamed to geonode_mapstore_client/static/mapstore/dist/js/1167.5f05167896fc17243fd2.chunk.js.LICENSE.txt

File renamed without changes.

geonode_mapstore_client/static/mapstore/dist/js/1174.251757fe2c4f7ecbe130.chunk.js renamed to geonode_mapstore_client/static/mapstore/dist/js/1174.5f05167896fc17243fd2.chunk.js

File renamed without changes.

0 commit comments

Comments
 (0)