humanmade / repress

Connect your Redux store to the WordPress REST API.
Other
83 stars 11 forks source link

Repress Next #36

Open rmccue opened 5 years ago

rmccue commented 5 years ago

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 to posts 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 for withArchive. We need to change a fair few other bits too:

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

rmccue commented 5 years ago

From #41:

In Repress Next (#36) we should combine archives, archivePages, and archivesByPage into a single item in the state instead, as archives is now a redundant store of the combined subobjects in archivesByPage.

We should also consider moving more-style pagination into the handler rather than the store.