Open rmccue opened 5 years ago
From #41:
In Repress Next (#36) we should combine
archives
,archivePages
, andarchivesByPage
into a single item in the state instead, asarchives
is now a redundant store of the combined subobjects inarchivesByPage
.
We should also consider moving more-style pagination into the handler rather than the store.
This is a tracking issue for some design changes to Repress.
As we've worked with Repress more, some of the initial design decisions have turned out to be suboptimal. I'll attempt to summarise these below.
Too Post-Specific
Repress can deal with any standard REST API data that follows the pattern of
/nouns?{query}
,/nouns/{id}
, and where the object looks like{ "id": <int> }
. However, the terminology throughout Repress refers toposts
all the time, which makes things very weird when you have a list of e.g. categories.https://github.com/humanmade/repress/issues/2 suggested changing this to a more generic
items
forwithArchive
. We need to change a fair few other bits too:withSingle
, rename the following props:postId
->itemId
post
->item
withArchive
, rename the following props:posts
->items
handler
, rename the following methods:isPostLoading
->isItemLoading
isPostSaving
->isItemSaving
isPostCreating
->isItemCreating
isPostDeleting
->isItemDeleting
fetchSingle
and friends tofetchItem
loadingPost
->loadingItem
posts
->items
Too Repetitive
getSubstate
is currently a function passed into methods as an argument. While this allows you to reuse the handler for multiple bits of state, the actions are already tied to the state location, so it turns out to be useless.To reduce the amount you need to repeat yourself, we should move this to the handler instead: https://github.com/humanmade/repress/issues/1