This is sort of a "best practices" question, since I'm not clear on the right way to handle this case.
The situation is that I have a bookstore app with a list of books that exists as state.bookstore.books. When the visitor loads the index page of the bookstore, a thunk action is dispatched that loads all the book objects in the user's collection into the state.bookstore.books array.
From the bookstore page, a user can click on an individual book, and a new page is loaded that pulls the book item from the state books array and displays the details.
My problem is that if a user directly visits the book detail link (eg. "mysite.com/book/123") without first going through the homepage, the state.bookstore.books array is empty, and the page has no data to display.
My question is what is the "right" way to do this? Would I dispatch the loadBookstore action to populate the state anytime the app is initialized? Would I create a new redux feature for book? Would I ignore looking up the book in the state, and just grab the specific book record from the server?
I am assuming that I'm doing it wrong / implementing an anti-pattern because selectors are not built to take parameters, so it seems like since there's no easy way to grab book 123 from the store, then I shouldn't be doing it this way.