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
When I open my view controller I can see my empty view momentarily then it switches back to loading state. How to avoid that? Either you introduce a new "Initial State" or make Loading state by default state.
I always face this issue when showing empty states, and always came to a different workaround.
You can try to set your loading when the VC disappears, when you have an empty state to show:
I think this may be the same issue I was seeing here (and I am seeing again): #47
Since the view presentation is being pushed to a subsequent run loop with DispatchQueue.main.sync(), perhaps it is undefined as to whether it occurs in time to mask the content view? I personally only see the issue intermittently.
As I suggested before, you could guarantee that this can't happen in the viewWillAppear scenario by doing something like this in transitionToState(...):
However, again I notice that the issue is complicated further by the async queue call, which sounds like it could be the more likely culprit, i.e. we have no idea when this code will be executed in relation to the content view's presentation on the main thread.
Perhaps if animated == false and the queue is empty, the presentation should just happen 'now' on the main thread?
Activity
douglasd3 commentedon Apr 4, 2017
I always face this issue when showing empty states, and always came to a different workaround.
You can try to set your loading when the VC disappears, when you have an empty state to show:
It worked for me.
aschuch commentedon May 15, 2017
I am unable to reproduce this issue. The example project calls
startLoading()fromviewWillAppearto make sure the loading state is shown immediately.FWJonathan commentedon Jun 29, 2017
I think this may be the same issue I was seeing here (and I am seeing again): #47
Since the view presentation is being pushed to a subsequent run loop with
DispatchQueue.main.sync(), perhaps it is undefined as to whether it occurs in time to mask the content view? I personally only see the issue intermittently.As I suggested before, you could guarantee that this can't happen in the
viewWillAppearscenario by doing something like this intransitionToState(...):FWJonathan commentedon Jun 29, 2017
However, again I notice that the issue is complicated further by the async queue call, which sounds like it could be the more likely culprit, i.e. we have no idea when this code will be executed in relation to the content view's presentation on the main thread.
Perhaps if
animated == falseand the queue is empty, the presentation should just happen 'now' on the main thread?