fjvallarino/monomer

UI not updating immediately when the button that is clicked on is removed (bug?)

Closed this issue · 2 comments

Hello!

I think this is probably a bug -- it is certainly unexpected:

  • I have a widget that contains a button.
  • When the button is clicked, the state is changed such that the entire widget tree is replaced by a different widget tree.
  • When this happens, the screen goes blank instead of showing the new widget immediately -- this is the bug!
  • However, when the mouse is moved a little, then the new widget appears.

I have attached a modification of the hello-world starter that demonstrates the issue: monomer-ui-not-updating-issue.zip

I guess this is somehow related to the button that is being clicked on being removed, since the issue does not seem to occur if clicking on the button leaves the button as-is but causes a different widget to be replaced.

This is indeed a bug! It seems I never tested replacing the root element for a widget of a different type. All the applications and examples I created have a Container as the root, and this bug in Composite remained hidden. Just in case you want to test, you can replace:

buildUI wenv = \case

with

buildUI wenv = box . \case

and it will work as expected since it uses the box container as the root.


I pushed a PR fixing the bug in Composite, and your example should now work without changes. To test it, you need to modify your stack.yaml to use this specific commit:

- git: https://github.com/fjvallarino/monomer.git
  commit: 8e3d676e1acf1555c876b19dba9497414d934579

Thanks for reporting this!

I'll close the issue for the time being; this changeset will be included in the next release.

Please re-open or create a new one if needed!