From cb89d29ca2bf2e797d3094101c0363fb80bae773 Mon Sep 17 00:00:00 2001 From: Christina Toegl <toegl@tugraz.at> Date: Mon, 22 Feb 2021 16:27:38 +0100 Subject: [PATCH] Try to fix another uncaught syntax error in adapter-lit-element --- packages/provider/src/adapter-lit-element.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/packages/provider/src/adapter-lit-element.js b/packages/provider/src/adapter-lit-element.js index 206b8a97..b245cb27 100644 --- a/packages/provider/src/adapter-lit-element.js +++ b/packages/provider/src/adapter-lit-element.js @@ -286,13 +286,14 @@ export class AdapterLitElement extends LitElement { } break; default: - // The function should not be called if newValue is empty but name and oldValue are set + // The function should not be called if oldValue is an object, oldValue and newValue are empty + // or if newValue is empty but name and oldValue are set // This should prevent 'Uncaught SyntaxError: JSON.parse unexpected end of data at line 1 column 1 of the JSON data' - if (newValue || !oldValue || !name) { - super.attributeChangedCallback(name, oldValue, newValue); - // } else { - // console.debug("attributeChangedCallback ignored", name, oldValue, newValue); + if ((typeof oldValue === 'object' && !oldValue && !newValue) || (!newValue && oldValue && name)) { + // console.debug("attributeChangedCallback ignored", name, oldValue, newValue); + break; } + super.attributeChangedCallback(name, oldValue, newValue); } // console.debug("this.lang", this.tagName, name, this.lang); -- GitLab