humanmade / humanmade/repress

Repress Next

Open
#36 1 comment 1 reaction 0 assignees View on GitHub
Dominant language
JavaScript
Stars
82
Forks
8
PR merge metrics
No merged PRs in 30d

Description

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": }`. 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:

* In `withSingle`, rename the following props:
* `postId` -> `itemId`
* `post` -> `item`
* In `withArchive`, rename the following props:
* `posts` -> `items`
* In `handler`, rename the following methods:
* `isPostLoading` -> `isItemLoading`
* `isPostSaving` -> `isItemSaving`
* `isPostCreating` -> `isItemCreating`
* `isPostDeleting` -> `isItemDeleting`
* Consider renaming `fetchSingle` and friends to `fetchItem`
* In the state, rename the following keys:
* `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

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.