Skip to content

Commit a587642

Browse files
committed
fix: setConfig
1 parent 1fc38d9 commit a587642

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/GEOComp.tsx

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ import { geoContext } from './GEOContext';
2727
import { layersControl } from './LayersControl';
2828
// @ts-ignore
2929
import Notification from 'ol-ext/control/Notification'
30+
import { object } from 'prop-types';
3031

3132
/**
3233
* Array of style configuration objects for styling the component.
@@ -568,6 +569,10 @@ GEOComp = withMethodExposing(GEOComp, [
568569
name: "filter",
569570
type: "JSONValue",
570571
},
572+
{
573+
name: "merge",
574+
type: "boolean",
575+
},
571576
]
572577
},
573578
execute: async (comp: any, params: any) => {
@@ -590,7 +595,11 @@ GEOComp = withMethodExposing(GEOComp, [
590595
}
591596
//Load the new values by dispatching them,
592597
//First merging the current values with the new values
593-
comp.dispatch(changeValueAction(deepMerge(comp.toJsonValue(), data), true))
598+
if (params[2] == true) {
599+
comp.dispatch(changeValueAction(deepMerge(comp.toJsonValue(), data), true))
600+
} else {
601+
comp.dispatch(changeValueAction(Object.assign({}, (comp.toJsonValue(), data), true)))
602+
}
594603
return true
595604
} catch (e) {
596605
console.error("Failed to parse config data", e)

0 commit comments

Comments
 (0)