TokamakUI / Tokamak

SwiftUI-compatible framework for building browser apps with WebAssembly and native apps for other platforms
Apache License 2.0
2.62k stars 111 forks source link

Fiber Reconciler fixes #525

Closed ahti closed 1 year ago

ahti commented 2 years ago

This is what I have done so far to make the example (with a little modification) from #523 work.

Currently, things work until returning to the initial state, after which pressing the button will leave an empty screen.

Some comments in no particular order:

carson-katri commented 2 years ago

I don't recall specifically, but the parent may be be optional because the root of the hierarchy has no parent and could hypothetically be removed.

carson-katri commented 2 years ago

Tested on a small project and didn't notice any regressions.

ahti commented 1 year ago

I finally found some time and started refactoring ReconcilePass.reconcile (not quite done with that), and also fixed the empty screen when going through all the states of the reproducer and then from .a to .b again (nothing was inserted when a fiber that should have an element had an alternate, but the alternate didn't have an element).

There is still an issue with label content not being updated tho, which I'm going to look into next.

ahti commented 1 year ago

Fixed the stale label content as well.

The only issue left that I am aware of is the .remove mutation with wrong parent. I've extended the test to reproduce that one, too. Oh and the reconcile method could still be dryed a bit further.

I also changed the test renderer so that multiple changed fibers get batched like they do in real renderers. Without that, the test was kind of flaky and would randomly succeed or fail (before adding the part to reproduce the remove bug, that is).

ahti commented 1 year ago

superseeded by #542