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
import {atom} from "jotai"; const abc = [atom("message")]; console.log(abc.length): // Outputs undefined
Instead abc is now an atom (init, read, write properties), so I believe something is causing abc to be overwritten.
abc
init
read
write
Amusingly, the following works as expected
import {atom} from "jotai"; console.log([atom("message")].length): // Outputs 1
If I remove @swc-jotai/react-refresh from the list of swc plugins, it works. What could be the problem?
@swc-jotai/react-refresh
It seems to be a general problem where assigning a variable with an expression that involves atoms will assume that the variable is the atom.
const abc = () => [atom('message')] // abc is once again an atom
A workaround is to wrap the construction in a named function.
function abc() { return [atom('message')]; } const foo = abc(); console.log(foo.length) // 1 !
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Instead
abc
is now an atom (init
,read
,write
properties), so I believe something is causingabc
to be overwritten.Amusingly, the following works as expected
If I remove
@swc-jotai/react-refresh
from the list of swc plugins, it works. What could be the problem?It seems to be a general problem where assigning a variable with an expression that involves atoms will assume that the variable is the atom.
A workaround is to wrap the construction in a named function.
The text was updated successfully, but these errors were encountered: