-
-
Notifications
You must be signed in to change notification settings - Fork 4.6k
Closed
Labels
Description
Describe the bug
When using a setTimeout with a function containing a signal inside an effect to create a debounce effect, the timeout is not re-run when the signal is updated. Not sure if this is a bug or feature since the signal is within a function and not directly under the effects scope.
Reproduction
<script>
let searchTerm = $state("")
let sentData = $state("Not sent")
function sendRequest() {
}
$effect(()=>{
setTimeout(()=>{
sentData = "Sent " + searchTerm
},300)
})
</script>
<input bind:value={searchTerm} />
<br>
Sent: {sentData}
Logs
No response
System Info
repl is enough
Severity
annoyance
calvo-jpcalvo-jp and joakim