player-ui / player

https://player-ui.github.io
MIT License
68 stars 44 forks source link

Android: Race condition causes previous view to hydrate again #403

Open A1shK opened 1 week ago

A1shK commented 1 week ago

Describe the bug These changes exposed a race condition in player. Sometimes when we update an input and skip validations when continuing to the next screen, the previous screen gets rendered again in navigation.

To Reproduce Replace default.json with this gist and run the android demo app. Type in something in the input field and click continue. You might have to try this a few times and maybe navigate to another flow and come back for the race condition to happen. But you will know it happens when you click "Continue" and you are still one the first screen with the input.

race-condition.webm

These are the logs from the last navigation in the above video:

image

You can see that tmp.required was updated and we transitioned from VIEW_Start to VIEW_Navigated using Continue. But then you can see another log showing that view with ID KitchenSink-Skip-Validation took 69ms to render and display on screen.

Expected behavior

The view with ID KitchenSink-Page-Navigated should have rendered.

Environment:

Tried this on both bazel 5 and bazel-6-android branches.

Additional context

A1shK commented 1 week ago

I am going to spend today looking into this but would love any pointers or ideas from someone more familiar with this space