mitosis
mitosis copied to clipboard
Update detection for web components doesn't detect change if previous value was undefined
I am interested in helping provide a fix!
Yes
Which generators are impacted?
- [ ] All
- [ ] Angular
- [ ] HTML
- [ ] Qwik
- [ ] React
- [ ] React-Native
- [ ] Solid
- [ ] Stencil
- [ ] Svelte
- [ ] Vue
- [X] Web components
Reproduction case
coulnd't make one because it needs a page to render the component as well
Expected Behaviour
The onUpdate method of the web component to be called every time a value from the dependency array changes.
Actual Behaviour
If the previous value of the on update is undefined, then the value of the __hasChanged
is undefined and the onUpdate doesn't run.
Additional Information
I've spotted the issue and have solve it locally by replacing the .find
calls in packages/core/src/generators/html.ts
with .some
calls