There seems to be a bug with WKWebView where sometimes there will be a substantial delay when attempting to load a URL (https://developer.apple.com/forums/thread/656106). In Turbolinks, this will only happen during a ColdBootVisit where we are navigating to a webpage using the normal URLRequest. By and large this really only happens when the app first starts up so a user will see the blank blue screen for a long time before either then seeing dashboard or the login page. It also can happen if the session is still valid, but maybe the app has not been used in a while and Turbolinks somehow becomes uninitialized. It can also happen after trying to logout.
I've determined where in the navigational callbacks the delay happens and implemented a check after 3 seconds to see if we have received a response yet. If we have not, we cancel the page load and start it again. This hack has proven to work in reducing how frequently this bug affects page load times.
There seems to be a bug with WKWebView where sometimes there will be a substantial delay when attempting to load a URL (https://developer.apple.com/forums/thread/656106). In Turbolinks, this will only happen during a
ColdBootVisit
where we are navigating to a webpage using the normalURLRequest
. By and large this really only happens when the app first starts up so a user will see the blank blue screen for a long time before either then seeing dashboard or the login page. It also can happen if the session is still valid, but maybe the app has not been used in a while and Turbolinks somehow becomes uninitialized. It can also happen after trying to logout.I've determined where in the navigational callbacks the delay happens and implemented a check after 3 seconds to see if we have received a response yet. If we have not, we cancel the page load and start it again. This hack has proven to work in reducing how frequently this bug affects page load times.