You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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:
constcreateItem=(id: string,store: any): any=>{letitemProxy=proxy({
id
});derive({// commenting out the `isSelected` derived property magically causes the `isHovered` property to workisSelected: (get)=>{returnget(store).selected===get(itemProxy).id;},isHovered: (get)=>{returnget(store).hovered===get(itemProxy).id;}},{proxy: itemProxy});returnitemProxy;};conststore=proxy({selected: (undefinedasunknown)asstring,hovered: (undefinedasunknown)asstring,byId: {}asRecord<string,{id: string;readonlyisHovered: boolean;readonlyisSelected: boolean;}>});store.byId.a=createItem("a",store);store.byId.b=createItem("b",store);constnextTick=(t=0)=>newPromise((resolve)=>setTimeout(resolve,t));console.group("setting hovered to item A");store.hovered="a";awaitnextTick();console.log("a.isHovered",store.byId.a.isHovered);// trueconsole.log("b.isHovered",store.byId.b.isHovered);// falseconsole.groupEnd();console.group("setting hovered to item B");store.hovered="b";awaitnextTick();console.log("a.isHovered",store.byId.a.isHovered);// falseconsole.log("b.isHovered",store.byId.b.isHovered);// false, should be trueconsole.groupEnd();
Transferred from: pmndrs/valtio#687 by @DavidMulder0
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
The text was updated successfully, but these errors were encountered: