Closed Priyankaa2503 closed 1 year ago
yeah, I think it will be ok to merge this.
This should take care of several problems with this
"I think if the db is empty the 'addbook' button should be displayed along with a message informing the user that the db is empty."
Yes, thats correct @BlackBond06
"Isn't this action (populating the UI with books from data.json file) suppose to happen when there is an actual error from the db and not when the db is empty?"
It should probably do both, but when the db is empty you should get a message saying it is empty and it needs to be populated. Normally this wouldn't happen, but.. one never knows when it might not, unless an outage is scheduled. Also because we will likely need some visible data in the UI during development several things can happen:
With the current state of app, changes in this PR will populate the UI from Json data, when the app loads, since the db is empty. After adding a book, the app state will change from displaying all that json data to showing only the added book. Don't know if this is a good user experience.
It might not be the best UX, but I think it could be impoved upon with some work.
In production, it would be relatively unlikely there would be no books in the database as we would want 100% uptime or as near as possible, unless the database was down for maintenance.. and at that point the user would only have their library (if they had any) showing in their "Library" tab in the left nav drawer.
We still have to add that UI for the Library tab.
With the current state of app, changes in this PR will populate the UI from Json data, when the app loads, since the db is empty. After adding a book, the app state will change from displaying all that json data to showing only the added book. Don't know if this is a good user experience.
No, if you add a book both the data is shown(i.e from Json,added book) because the json data is added to the db at initial render
Yeah, that sounds a lot more like it to me @LOGESH-B
With the current state of app, changes in this PR will populate the UI from Json data, when the app loads, since the db is empty. After adding a book, the app state will change from displaying all that json data to showing only the added book. Don't know if this is a good user experience.
No, if you add a book both the data is shown(i.e from Json,added book) because the json data is added to the db at initial render
Oh okay, that looks good then. Thank you for the clarification @LOGESH-B.
@BlackBond06 @LOGESH-B can we now review this?
Fixes Issue #179
This PR : 1) Seeds the database with default books using existing JSON data to prevent loading issues when the database is empty. 2) In addition to this, the user can see a "add book" option.