Closed wadlo closed 1 year ago
Nevermind, this was an issue with not updating the internal state.
Reopening this to propose new behavior. Right now the ViraInput
only updates its size if fixedText: true
is set and an updateState
is called. I'd expect updateState
not be required for it to update width. In fact, I'd expect just
<${ViraInput}
${assign(ViraInput, {value: "initialText", fitText: true})}
</${ViraInput}>
to automatically update size when the input is changed. Or if that's not possible, at least
<${ViraInput}
${assign(ViraInput, {value: inputs.habit?.getTrigger() ?? "Unknown", fitText: true})}
${listen(ViraInput.events.valueChange, (newVal)=>{inputs.habit?.setTrigger(newVal.detail);>
</${ViraInput}>
should work.
I'm not sure what getTrigger
is doing, but the input to these elements should always be a state variable that gets updated with updateState
. Thus, nothing is going to change unless it's changed with updateState
.
The architecture is like this:
So to make sure I understand,
parent - passes "input" to child.
child - child uses "input" and returns "output".
parent - receives the "output" from child
parent - callse updateState
based no the "output" to update "input".
parent - passes "input" to child. child - child uses "input" and returns "output". parent - receives the "output" from child parent - callse
updateState
based no the "output" to update "input".
Correct.
My only addition would be that the child will only return "output" (through events) if the input it received needs to change.
I think this is resolved, as there's no actual issue here, it boils down to a data flow question.
Is it intended that
ViraInput
withfitText: true
doesn't update dynamically? If I change the value of the input, then leave the screen and re-enter, it does update, but not while typing in the input field or after clicking out.Code: