Closed as not planned
Description
Describe the bug
Not sure if i am using runes as it should be, but I get : State referenced in its own scope will never update. Did you mean to reference it inside a closure? (state_referenced_locally)
when trying to store an initial value from a state
const { path } = $props()
const form = getFormContext()
const field = $derived(form.useField(path)) // access some usefull methods here depending on the path prop
const initialValue = field.value // <— warning here
const initialValue = $state.snapshot(field.value) // <— warning also
I know initialValue
won't change and this is what I am expected
What am I doing wrong ?
Reproduction
Logs
No response
System Info
System:
OS: macOS 14.4.1
CPU: (8) arm64 Apple M2
Memory: 84.00 MB / 8.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 22.5.1 - ~/.nvm/versions/node/v22.5.1/bin/node
npm: 10.8.2 - ~/.nvm/versions/node/v22.5.1/bin/npm
pnpm: 9.1.1 - /opt/homebrew/bin/pnpm
bun: 1.1.17 - /opt/homebrew/bin/bun
Browsers:
Brave Browser: 127.1.68.137
Chrome: 124.0.6367.208
Safari: 17.4.1
npmPackages:
svelte: 5.0.0-next.222 => 5.0.0-next.222
Severity
annoyance
Metadata
Metadata
Assignees
Labels
No labels