cerebral/overmind

[BUG] Tracking / statehooks of built in objects, like Date, broken in versions after v21

stianeikeland opened this issue · 3 comments

Compare the following two identical sandboxes.

State: a single Date
Actions: a single action to update Date

Overmind v21
Overmind v25

v21 renders current unixtime when button is pressed, v25 doesn't re-render.

Overmind releases after v21 also seem to have issues with other built-ins, like Map/Set, too (as reported in #419)

import { ProxyStateTree } from "proxy-state-tree";

type State = { date: Date };

const tree = new ProxyStateTree<State>({ date: new Date() });
const trackStateTree = tree.getTrackStateTree();
trackStateTree.track();

console.log(trackStateTree.state.date);
console.log(Array.from(trackStateTree.pathDependencies));

Expected output: ["date"]
Output from proxy-state-tree v4.6.0: ["date"]
Outout from proxy-state-tree v5.0.0 or later: []

Okay, thanks so much for a great example! A fix is in next and we now identify Date, Map and Set as native class instances allowed in the tree, but is not proxied. Which means only replacement of the value is tracked, not change so the Map/Set itself

Released