You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Per the documentation on the [RelayCommand] source generator I believe that by default that multiple taps on a button should not execute the same command multiple times. However, I am experiencing the situation where I load a page from a tap gesture command and the page gets pushed multiple times. Trying to figure out how to prevent this from happening. Is this a bug or is there something missing in the code that prevents this from happening.
I believe you can provide add property for controlling the CanExecute of the RelayCommand to prevent simultaneous executions.
privateboolcanTap;publicboolCanTap{
get =>canTap;privateset=>SetProperty(refcanTap,value);}[RelayCommand(CanExecute="CanTap")]publicasyncvoidTap(objectparam){try{CanTap=false;// ....<snipped/>...}finally{CanTap=true;}}
It makes me wonder if there should be a [AsyncRelayCommand] source generator as well.
@ketakidevendra I have not experienced this problem in some time. I believe it was fixed in one of the many updates since I opened this ticket. I need to test and verify but have not noticed it happening in my app.
Per the documentation on the [RelayCommand] source generator I believe that by default that multiple taps on a button should not execute the same command multiple times. However, I am experiencing the situation where I load a page from a tap gesture command and the page gets pushed multiple times. Trying to figure out how to prevent this from happening. Is this a bug or is there something missing in the code that prevents this from happening.
https://learn.microsoft.com/en-us/dotnet/communitytoolkit/mvvm/generators/relaycommand#handling-concurrent-executions
This can be observed in this test app
https://[email protected]/bradyguychambers/MyNextBook/_git/Test%20Multiple%20Taps
This can be observed in this test app.
https://[email protected]/bradyguychambers/MyNextBook/_git/Test%20Multiple%20Taps
The text was updated successfully, but these errors were encountered: