You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently it's not possible to reflect prop changes in the custom element attributes.
Describe the proposed solution
Due limitations caused by the fact that svelte-retag isn't able to hook into Svelte compiler options (at least not for now), the developer must first manually enable accessors in their component like so:
<svelte:optionsaccessors />
svelte-retag would then add a new props option (if not already present, see #13) and include a reflect option, e.g.
patricknelson
changed the title
Add ability to reflect props changes back to attributes
Add ability to reflect prop changes back to attributes
Dec 13, 2023
Describe the problem
Currently it's not possible to reflect prop changes in the custom element attributes.
Describe the proposed solution
Due limitations caused by the fact that
svelte-retag
isn't able to hook into Svelte compiler options (at least not for now), the developer must first manually enable accessors in their component like so:svelte-retag
would then add a newprops
option (if not already present, see #13) and include areflect
option, e.g.Once configured, modifications to
greetPerson
from within the component would be reflected in thegreetperson
custom element attribute.Implementation Details
The attribute
MutationObserver
should be aware of reflected changes to prevent infinite loops.See if possible to automate setting of
accessors
option if already hooking into compiler processTo watch for updates, one would have to utilize the
after_updates
array available on the component instance, e.g.Alternatives considered
None.
Importance
nice to have
The text was updated successfully, but these errors were encountered: