leptos
leptos copied to clipboard
Hard to Debug NodeRef Warning
Describe the bug
When getting the warning:
[Warning] You are setting a NodeRef that has already been filled. It’s possible this is intentional, but it’s also possible that you’re accidentally using the same NodeRef for multiple _ref attributes.
There is no stack trace or way to debug where this warning originates, which NodeRef has already been filled and where to look for it
Leptos Dependencies
leptos = { version = "0.6.9", features = ["csr"] }
leptos_meta = { version = "0.6.9", features = ["csr"] }
leptos_router = { version = "0.6.9", features = ["csr"] }
To Reproduce Steps to reproduce the behavior:
- That's the issue, I don't know how to reproduce this
Expected behavior A stack trace or more information of any kind would really help
Screenshots
Additional context
The solution here would be to do what we do for other signals and add a debug-mode-only defined_at: &'static Location<'static> to NodeRef, with #[track_caller] on the functions that allow you to create node refs, so that it can log "You are setting a NodeRef, defined at {defined_at}...` instead. It is not likely I will get to this in the near future but would welcome a PR from anyone.
I think that PR above is a good reponse to the problem.