Source Directory
Store

Custom Stores

The core documentation can be found here (opens in a new tab) which breaks down the dependencies and the parts of the Redux implementation.

It should be noted that WordPress's store implementation resembles Redux (opens in a new tab), but is largely it's own implementation and differes enough that Redux documentation may not be as helpful as Core docs. The comparison can be read here (opens in a new tab).

Existing Custom Stores

The pmc-gutenberg plugin currently has two custom stores located at /src/store/ (opens in a new tab).

PMC

The code can be found here (opens in a new tab).

This store handles custom features for post locking, Exact Target BNAs Newsletters, site settings, post revisions, and notices.

The reducers, selectors, controls, and resolvers live in the main index.js while actions are in their own actions.js for organization's sake.

Nova Homepage

The code can be found here (opens in a new tab).

This store handles the homepage backfill feature for nova both the reading and writing of post data. It also handles fetching and setting post content for the editor.

The reducers, selectors, controls, and resolvers live in the main index.js while actions are in their own actions.js for organization's sake.

fetchBackfill

Fetch settings action.

setPost

Set the post.

  • postId: number — Post id.
  • post: Object — Post.

setBackfillMapping

Set the backfill mapping.

  • mapping: Object — Backfill mapping.

fetchFromAPI

Fetch post.

  • path: string — Fetch URL.

lockPostSave

Trigger lock post save.

  • lockId: string — Lock it.

unlockPostSave

Trigger unlock.

  • lockId: string — Lock it.

setPostRevisions

Set post revisions action.

  • postRevisions: Array — Revisions array.