Skip to content
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

Recursive time loop bug #16

Closed
2 tasks
barneycarroll opened this issue Mar 16, 2016 · 6 comments
Closed
2 tasks

Recursive time loop bug #16

barneycarroll opened this issue Mar 16, 2016 · 6 comments

Comments

@barneycarroll
Copy link
Owner

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:

  • Is one component directly invoking another component as its immediate root? This could lead to duplicate superConfigs but not, one would think, a multiply recursive one this deep…
  • How easy / reliable / efficient could it be to check whether the component root was already registered / its config already bound?
@barneycarroll
Copy link
Owner Author

It's pretty grim:
image

@barneycarroll
Copy link
Owner Author

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
Copy link
Owner Author

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 barneycarroll changed the title superConfig is recursive Recursive time loop bug Mar 17, 2016
@barneycarroll
Copy link
Owner Author

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 added a commit that referenced this issue Mar 17, 2016
The root view trap can't capture a fully computed virtual DOM snapshot because of Mithril's deferred computation of nested components. This should solve the problem by capturing fully computed snapshots post render.
@barneycarroll
Copy link
Owner Author

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

@barneycarroll
Copy link
Owner Author

Fixed in c7c9b94, released in v1.1.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant