From a8c7a04398f70fbf228ce614facb01d334337e9d Mon Sep 17 00:00:00 2001 From: Jonathan Bertoldi Date: Fri, 8 Jul 2022 08:26:15 -0300 Subject: [PATCH] Fix bindable Fix bindable when object can be possible undefined, for instance: `bind={user.profile?.age`. Turns the responsibility to the user being easier to identify the error. --- plugins/bindable.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/bindable.js b/plugins/bindable.js index 219f9ce5..e0dc0827 100644 --- a/plugins/bindable.js +++ b/plugins/bindable.js @@ -6,7 +6,7 @@ function match(node) { function transform({ node, environment }) { if (!match(node)) return; - const object = node.attributes.bind.object; + const object = node.attributes.bind.object ?? {}; const property = node.attributes.bind.property; if (node.type === 'textarea') { node.children = [object[property]]; @@ -27,4 +27,4 @@ function transform({ node, environment }) { } } -export default { transform, client: true, server: true } \ No newline at end of file +export default { transform, client: true, server: true }