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

Updating UI from Background Thread stops working after Navigating to a Page more than once #18182

Open
MartinZikmund opened this issue Sep 11, 2024 Discussed in #18178 · 3 comments

Comments

@MartinZikmund
Copy link
Member

Discussed in #18178

Originally posted by ebondur September 10, 2024
I am currently trying to update the UI of a page when an NFC read occurs. As monitoring the android device for NFC messages occurs on a background thread, the UI is updated from the background thread as well. When I first navigate to the page, everything works as expected. However, when I navigate away and back to the page, all UI updating stops. Here is the current behavior using a button to simulate NFC reads:

Example.mp4

Expected behavior is that The UI should update every time if the updates originate from the background thread, even if the page has been navigated to more than once. Only way to fix the issue is to close and reopen the app, which is not viable solution.

Sample Repo can be found here.

@Youssef1313
Copy link
Member

Shouldn't UI updates be pushed through dispatcher when on background thread rather than updating it from the background thread? Does pushing to dispatcher make any difference?

@ebondur
Copy link

ebondur commented Sep 11, 2024

Using the dispatcher does not make any difference....

Could this be due to the generated models and data binding?

@ebondur
Copy link

ebondur commented Sep 11, 2024

Fwiw, I managed to devise a workaround via accessing the bindable model's ICommand for updating the UI. In the sample repo, this is on the Workaround branch.

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

3 participants