Derive working with single derived property, but failing with two #806
Replies: 10 comments
-
For whatever it is worth, when |
Beta Was this translation helpful? Give feedback.
-
Hmmm, it sounds like a bug. Probably a tough one. Hope someone can dig into it. |
Beta Was this translation helpful? Give feedback.
-
Still trying to wrap my head around what's happening, but just going to share what I got: After initialization of the store the store.byId.a = createItem('a', store);
store.byId.b = createItem('b', store);
await time();
console.log(
sourceObjectMap.get(store.byId.b).pendingCount
); // -4 What seems to happen is that at the time of the Execution order as far as I understand it is:
Thus waiting a tick between store.byId.a = createItem('a', store);
await time();
store.byId.b = createItem('b', store); A solution that might work is to make a shallow copy of the subscriptions before the |
Beta Was this translation helpful? Give feedback.
-
Plus, I haven't yet mentally modelled out why commenting out the |
Beta Was this translation helpful? Give feedback.
-
@DavidMulder0 Hey, have you figured this out? I am experiencing the same issue and its pretty hard to wrap the head around the source code, would be helpful if you can give me a headstart |
Beta Was this translation helpful? Give feedback.
-
I have the same problem as well! After a VERY cursory look, I'm not sure what the point of running without
What's the objective of |
Beta Was this translation helpful? Give feedback.
-
With |
Beta Was this translation helpful? Give feedback.
-
Alright, that's reasonable. Just throwing
I was also attempting derive state from 2 separate proxy objects. For that, I've just created a third proxy object, which I update with |
Beta Was this translation helpful? Give feedback.
-
btw, here's an RFC related to this issue: #792 |
Beta Was this translation helpful? Give feedback.
-
Transferred to: valtiojs/derive-valtio#2 |
Beta Was this translation helpful? Give feedback.
-
Summary
Have a hard time describing the issue, because if I had figured out what's exactly going on I would be doing a pull request instead of a bug report, however I do have a decently clean MVE:
Link to reproduction
https://codesandbox.io/s/laughing-gates-mo58dj?file=/src/index.ts
Beta Was this translation helpful? Give feedback.
All reactions