Closed christophe-g closed 3 years ago
Thanks for your contribution! :smiley:
npm i lit-state@1.6.1
https://gitaarik.github.io/lit-state/build/#test-cases/reconnected-components/
That looks good !
lit-state
will be used in idata.tools (massive app migration from Polymer 2.0 to lit currently underway)
Cool! Nice to see LitState is useful to you. Hope the migration will work out well. Let me know if you run into any problems.
In a situation where an observed component is removed from the dom (no more
_observers
) and restamped later on, the binding with state will only be effective if the component updates again. In case state has changed in between, the newly stamped component will be out of sync.The fix should be as simple as calling
requestUpdate
inconnectedCallback
(I'll provide a PR shortly).I experienced this in this scenario (using
lit-state
in conjunction with https://github.com/andreasbm/router-slot):formCompose
is cached and not re-created when the active route iscompose
. Potential state changes are not reflected in the first re-paint.