Users can only access offline screens if the required data is cached
The offline screens should only show to the users if they have all of the required information to let users work with this screen offline. In case there's anything missing in the cache, we should let the user know that certain data is missing and not allow them to work with the screen. E.g. not showing empty dropdowns for required inputs.
Note: We should handle two cases:
There's nothing cached because there's nothing on the server as well
There's nothing cached because the application didn't manage to cache something yet
In case something is not cached because the application didn't manage to cache it yet, we should show an error on an attempt to enter the screen. It could read: "The data required to access this screen is not cached. We will fetch it once you are online again."
Tested with success
There is no chance to see the empty reason dropdown
I run the reproduction steps for reasons, valid destinations, and valid sources - with success
When we for example go to Issue, delete reasons, go Home and refresh the page, next go offline and come back for Issue page- we can see the error message with is correct
Google Chrome Browser Version 85.0.4183.83
QA Note: Please run the reproduction steps for reasons, valid destinations, and valid sources.
Code changes look good to me
I’ve found out that the following steps lead to the issue with missing reasons:
Log into the application and wait for the cache
Remove reasons from the local storage
Go offline to Stock Management > Issue > Make Issue screen (or any other stock screen)
The reasons are still displayed in the dropdown
Go online and move to the Home page or any different (not stock) and refresh page
Go offline again and move to any stock screen
Now you are able to access the screen but the reasons' dropdown is empty
It looks like we need to handle the situation when reasons are not cached in the local storage and the user is offline.