-
-
Notifications
You must be signed in to change notification settings - Fork 681
New issue
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
Panic on write to nested Vec in a Store #3338
Comments
I have not looked into this fully yet. However, something occurs to me right away: You are generating UUIDs as keys, and you start with items in both the Outer and Inner structures. However, you're also using SSR + hydration, which means that the code runs on both sides. As a result, you are generating different UUIDs: the data in the list is different on the server from the client. Like I said, I have no idea if this is related and I have not tried running the example, it just occurs to me as I look at the code. |
A very reasonable question, and my first thought was that the Uuids might have had something to do with it. I did, however, observe the error with fixed usize as well. I just happened to settle on uuid in this example. It's closer to my use case, which you can see it in a help thread on discord if you like. Thanks for looking into it when you have time 😊 |
Having played around for an hour or so this evening, I do think that there is simply an issue with nested keyed fields at the moment. I will try to find some time to look at it in more depth in the upcoming weeks. |
I appreciate the time you put in to making this work, when you have it to spare 🙏 |
As is so often the case, sleeping on it for a night and coming back to it made all the difference. #3344 should fix this issue: I tested it against your example and it seems to work correctly but let me know if that's not the case. |
That's fantastic! I haven't managed to test it in my project yet, but the minimal example should suffice to be confident. |
Describe the bug
I tried using a nested
<For>
with a Store. However, when I write to the inner Vec I get a wasm panic in the browser.I think this would be the same as if I had a
Vec<Tag>
on a Todo, and tried usingouter.inner().write().push(new)
as in the stores example to extend the Tag list.Leptos Dependencies
Starter axum template, 0.7 + reactive_stores, nightly.
Minimal example: https://github.com/purung/stores_inner_error
Expected behavior
I am sure I am missing something, but I would have expected this to work since stores are about ergonomics with nested structure, and I used methods shown in the example. Or, a compiler error.
Error output
The text was updated successfully, but these errors were encountered: