AlexxNB / tinro

Highly declarative, tiny, dependency free router for Svelte's web applications.
MIT License
675 stars 30 forks source link

use:action is not reactive #87

Closed Prinzhorn closed 2 years ago

Prinzhorn commented 3 years ago

Since all the attributes are cached once the action is initialized (breaking assumptions about Svelte's reactivity and consistency), it does not react to any changes:

https://svelte.dev/repl/a41434e5206846a99eb7562bd6e17968?version=3.42.1

Sure these are edge cases, but if you create something like a CMS or app builder then dynamic menus/links will happen if you push live updates to the client (e.g. when using Meteor).

AlexxNB commented 2 years ago

Thanks! Sorry for long reaction. Since v.0.6.8 you can pass any reactive variables as active action parameters to update liks's state when they change.

Example:

<a href={foo ? '/#/' : '/#/not-home'} use:active={foo} exact>{foo ? 'Home' : 'Not Home'}</a>