When we are developing new functionality or performing tests in the application, it is very common to focus only when there is data to show in the view, what will happen if there is no data stored? For example, the first time the user is using the application.
I learned to always take into account cases when information does not exist the hard way. One time I was programming a new functionality within the application, at that time did not take into consideration that not all the necessary data will always exist to use in the view. I remember that when I tested this new view locally, everything worked without problems (because there was always data), I even added tests that passed the circleCI without problems.
When I start to review the code, the first thing that comes to mind is: The necessary information will not always exist. After I notice this added an “if condition” to avoid the problems that were occurring and voila! Everything started to work as it should be.
To solve this problem I added a message telling the user that there was no data at the moment, with an icon to reduce the blank space, and with this new change, the first time the view was used, it is seen with a user-friendly graphic design.
For these reasons it is vital to take into account the lack of data for the application, so we can avoid errors or that the view design looks awful due to the amount of white space. Also, the way to correct this problem is not so complicated, a simple if and a message solves this issue.