-
-
Notifications
You must be signed in to change notification settings - Fork 4.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Svelte 5 watch derived change and run view-transition #11870
Comments
First thing: please edit the reproduction to remove the code block and use a markdown link instead [Link name](https://.....) Second the question is not clear: do you want to use native view transition when the price change? |
Sorry my English is bad. I'm currently using the transition but transition doesn't work nicely with svelte 5. like you can see there is a lot of issues with animation/transition etc Svelte 5 animation/transition issues. I want when I filter the products to get animation with view transition api instead depending on svelte/animation svelte/transition |
Ok I'll make an example for you later |
Amazing, thank you so much I really appreciate it |
Is there an accepted way to accomplish this in Svelte 5? |
What do you mean by this? |
Say I wanted to watch for changes on variable
This code does a lot of magic, and without console.logging Maybe I'm missing something here. |
You can also do: $effect(() => {
foo;
bar();
}); |
This...but also...whats the use case specifically? Why you need to rerun a function when an unrelated variable changes? |
Or (repl): <script>
let count = $state(0)
function increment() {
count += 1
}
const bar = () => {
count
console.log("do something")
}
$effect(() => {
bar()
})
</script>
<button onclick={increment}>
clicks: {count}
</button> |
Fair enough. I think these are reasonable solutions, but by definition, not watchers. Now all of a sudden we have to be thinking about what code might trigger the A decent workaround, but by no means in my opinion a "watcher". |
Describe the bug
I make this simple product filter on top there is slider to filter products by price. I want to run view-transition when derived is changed. I dont know how to do it or how to even watch for derived change.
Reproduction
Code example
Logs
No response
System Info
Severity
annoyance
The text was updated successfully, but these errors were encountered: