Closed
Description
Description
I'm porting a feedback widget to Svelte. The widget has methods to add questions to a list; each question can either be a binary choice or a freeform text box. I want to funnel each question widget's value into an object mapping questionID -> answer
in the parent component.
It looks like you can bind <input>
element values to a computed attribute (e.g. https://svelte.technology/repl?version=1.22.2&gist=20fa77ffb878bdcc7a0e496df0df8e4f) but you cannot bind nested component state to a computed attribute.
Simple reproduction
https://svelte.technology/repl?version=1.22.2&gist=1aafb1485e848d0da03d647b40d75f28
Backtrace
TypeError: Cannot read property 'name' of null
at Object.visitBinding [as Binding] (/Users/andrew/Documents/greni/node_modules/svelte/compiler/svelte.js:13339:40)
at /Users/andrew/Documents/greni/node_modules/svelte/compiler/svelte.js:13439:35
at Array.forEach (native)
at visitComponent (/Users/andrew/Documents/greni/node_modules/svelte/compiler/svelte.js:13438:10)
at visitElement (/Users/andrew/Documents/greni/node_modules/svelte/compiler/svelte.js:14264:16)
at visit$1 (/Users/andrew/Documents/greni/node_modules/svelte/compiler/svelte.js:14605:5)
at /Users/andrew/Documents/greni/node_modules/svelte/compiler/svelte.js:14404:9
at Array.forEach (native)
at visitChildren (/Users/andrew/Documents/greni/node_modules/svelte/compiler/svelte.js:14403:19)
at getBranches (/Users/andrew/Documents/greni/node_modules/svelte/compiler/svelte.js:14384:5)