We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
When passing a async callback in $effect, causes error.
$effect
Example:
$effect( async () => { // ... code })
let count = $state(0); $effect( async () => { const request = await fetch('https://dummyjson.com/products/1') const json = await request.json() console.log(json) }) ### Logs _No response_ ### System Info ```shell System: OS: Linux 5.15 Ubuntu 22.04.2 LTS 22.04.2 LTS (Jammy Jellyfish) CPU: (16) x64 AMD Ryzen 7 5800X3D 8-Core Processor Memory: 10.00 GB / 15.58 GB Container: Yes Shell: 5.1.16 - /bin/bash Binaries: Node: 20.9.0 - ~/.volta/tools/image/node/20.9.0/bin/node Yarn: 4.0.1 - ~/.volta/tools/image/yarn/4.0.1/bin/yarn npm: 10.1.0 - ~/.volta/tools/image/node/20.9.0/bin/npm bun: 1.0.18 - ~/.bun/bin/bun Browsers: Chrome: 117.0.5938.88 npmPackages: svelte: 5.0.0-next.25
annoyance
The text was updated successfully, but these errors were encountered:
AFAIK, $effect doesn't accept async function as callback. Solution is to declare an async function inside the $effect callback and call that function
Sorry, something went wrong.
Duplicate of #9520. It is intentional that the types do not admit an asynchronous function.
No branches or pull requests
Describe the bug
When passing a async callback in
$effect
, causes error.Example:
Reproduction
Severity
annoyance
The text was updated successfully, but these errors were encountered: