Skip to content

Commit

Permalink
#10489: Fix 10438: Problems with GeoStory map configurations merge pr…
Browse files Browse the repository at this point in the history
…ocess (#10516)
  • Loading branch information
mahmoudadel54 authored Sep 5, 2024
1 parent 5c52799 commit d9f5390
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
11 changes: 10 additions & 1 deletion web/client/components/geostory/common/MapEditor.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import Message from '../../I18N/Message';

import MapConfiguratorTabs from './map/MapConfiguratorTabs';
import withMapConfiguratorTabs from './enhancers/withMapConfiguratorTabs';
import set from 'lodash/fp/set';


const StepHeader = ({title, description}) => (
Expand Down Expand Up @@ -102,7 +103,15 @@ const MapEditor = ({
closeNodeEditor={closeNodeEditor}
editNode={editNode}
map={map}
onChange={onChange}/>
onChange={(path, value) => {
const config = set(path, value, { map });
const { layers, groups } = config?.map || {};
if (path.includes('map.layers[')) {
onChangeMap('layers', layers, "replace");
} else {
onChangeMap('groups', groups, "replace");
}
}}/>
] ||
[
<MapConfigurator
Expand Down
4 changes: 2 additions & 2 deletions web/client/components/geostory/common/enhancers/map.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ export const withFocusedContentMap = compose(
*/
export const handleMapUpdate = withHandlers({
onChangeMap: ({update, focusedContent = {}}) =>
(path, value) => {
update(`${focusedContent.path}.map.${path}`, value, "merge");
(path, value, mode = "merge") => {
update(`${focusedContent.path}.map.${path}`, value, mode);
},
onChange: ({update, focusedContent = {}}) =>
(path, value, mode = 'merge') => {
Expand Down
1 change: 1 addition & 0 deletions web/client/utils/__tests__/GeoStoryUtils-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -823,3 +823,4 @@ describe("GeoStory Utils", () => {
});
});
});

0 comments on commit d9f5390

Please sign in to comment.