From 0aa0dad7fb80c3de90192cfdd9fb4d015e8b819e Mon Sep 17 00:00:00 2001 From: orangemug Date: Wed, 16 Oct 2019 22:31:29 +0100 Subject: [PATCH] Remove undefined root properties. --- src/components/modals/SettingsModal.jsx | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/components/modals/SettingsModal.jsx b/src/components/modals/SettingsModal.jsx index aaa714d1..43f881bf 100644 --- a/src/components/modals/SettingsModal.jsx +++ b/src/components/modals/SettingsModal.jsx @@ -59,9 +59,15 @@ class SettingsModal extends React.Component { changeStyleProperty(property, value) { const changedStyle = { ...this.props.mapStyle, - [property]: value + }; + + if (value === undefined) { + delete changedStyle[property]; } - this.props.onStyleChanged(changedStyle) + else { + changedStyle[property] = value; + } + this.props.onStyleChanged(changedStyle); } render() {