Comet icon indicating copy to clipboard operation
Comet copied to clipboard

View update not working on windows

Open TitusRie opened this issue 3 years ago • 1 comments

When running the RideTheComet app generated with the Comet template the label disappears after clicking the button.

Before clicking the button: afbeelding

After clicking the button: afbeelding

(also seems a problem with the rendering after resizing the window, see issue: https://github.com/dotnet/Comet/issues/267)

I'm using version 0.3.464-beta with Visual Studio 17.3.0 Preview 4.0

Way to reproduce:

  • dotnet new --install Clancey.Comet.Templates.Multiplatform::0.4.344-beta
  • dotnet new comet -n RideTheComet
  • Run project in Visual Studio
  • Click button

Workaround: Somehow it works to change the line: new Button("Ride the Comet! ☄️", ()=>{ to: new Button("Ride the Comet! ☄️" + comet.CometTrain, ()=>{

Somehow this forces the update and shows the label again. As it also fixes the rendering problem, I get the impression that the label is somehow hidden through rendering problems as mentioned in https://github.com/dotnet/Comet/issues/267

TitusRie avatar Jul 21 '22 12:07 TitusRie

I found that putting comet.Rides += 0; at the top of the body() function fixed it.

I believe all required state must be used in the function in order for it to render properly. Interestingly, the Live XAML view seemed to reflect the changes despite them not being rendered. I believe this is due to the OnPropertyRead system in StateManager not detecting reads in code present inside of the lambda. This obviously does not seem like it's intentional behavior since it's the exact same behavior defined in the examples.

Edit: Hmm. It seems that certain reloads (ones that call ResetView) seem to cause the bug. Adding the line: State.AddGlobalProperty((page.comet, "")); to my setup code seemed to solve this issue too. I don't know enough about Comet's internals to really diagnose this, but it looks like an issue where ResetView causes some things to get lost in transit (possibly a flawed Diff function???)

Mooshua avatar Aug 06 '22 20:08 Mooshua