barneycarroll / mithril.exitable.js

Exit animations for Mithril components: provide controllers with an `exit` hook which will trigger when the component disappears from the virtual DOM (but before it's removed from live DOM), locking the draw process while you perform animations.
MIT License
22 stars 3 forks source link

Recursive time loop bug #16

Closed barneycarroll closed 8 years ago

barneycarroll commented 8 years ago

As seen in this fiddle (which goes into a crazy tailspin as soon as any redraw is triggered — which looks like a Mithril key bug), superConfig can end up calling a superConfig. I would have thought this was impossible without processing views multiple times by saving the virtual DOM tree and reprocessing it in a subsequent view.

image

Things to test:

barneycarroll commented 8 years ago

It's pretty grim: image

barneycarroll commented 8 years ago

OK, progress: the saved snapshots are not static, meaning that during what should be a reversal to a historical computed view's virtual DOM output snapshot, we are in fact invoking dynamic components.

image

Need to ensure the view output is totally computed before saving.

barneycarroll commented 8 years ago

Gonna try proxying m.render and split the history logic between that and the root view trap.

I think the only reason trapped views are consuming trapped views is because of re-execution on historical patch, which would explain the infinite recursion on patch when the component is deemed missing again, and another trap consumes the previous recursive trap, ad infinitum.

barneycarroll commented 8 years ago

Better idea: config exposes the computed virtual DOM at render time. Use that — if root superConfig is already an essential hook for binding live DOM then it should also be used to capture snapshots.

barneycarroll commented 8 years ago

Patch works, but Mithril's key implementation still seems screwy.

barneycarroll commented 8 years ago

Fixed in c7c9b94, released in v1.1.2