Consider signIn taking long time (e.g. 30 seconds)... You don't want the button to be visually enabled and clickable with nothing happening. The most proper way is to disable the button until such time user can attempt signing in again (e.g. sign in failed or user has signed out).
Thank you for your answer. It is indeed already the case. The button disable state is linked to the isSigninIn. However I was wondering if here is a thing such as
ProtectedTask { await function }
or something like func signIn() async protected { ... }
which would ditch any attempt to start the same code/task when one is still running.
or maybe the Task itself would be the isSigninIn state.
The trick is simple. Store your task while it's active and remove it when it's done. If you somehow manage to call the synchronous function again then you will check if there is already a task running and ignore the invocation by simply returning and doing nothing.