Skip to content

Commit

Permalink
Migrate editor store to thunks (#35929)
Browse files Browse the repository at this point in the history
* Core data: add missing await in autosave()

* Editor store: no notice after trashing a post

* Migrate editor store to thunks
  • Loading branch information
jsnajdr authored Feb 14, 2022
1 parent 8effa05 commit 0bad51e
Show file tree
Hide file tree
Showing 12 changed files with 401 additions and 669 deletions.
27 changes: 12 additions & 15 deletions docs/reference-guides/data/data-core-editor.md
Original file line number Diff line number Diff line change
Expand Up @@ -1026,7 +1026,7 @@ _Related_

### autosave

Action generator used in signalling that the post should autosave. This
Action that autosaves the current post. This
includes server-side autosaving (default) and client-side (a.k.a. local)
autosaving (e.g. on the Web, the post might be committed to Session
Storage).
Expand All @@ -1049,8 +1049,7 @@ Action that creates an undo history record.

### disablePublishSidebar

Returns an action object used in signalling that the user has disabled the
publish sidebar.
Action that disables the publish sidebar.

_Returns_

Expand All @@ -1068,8 +1067,7 @@ _Parameters_

### enablePublishSidebar

Returns an action object used in signalling that the user has enabled the
publish sidebar.
Action that enables the publish sidebar.

_Returns_

Expand Down Expand Up @@ -1113,7 +1111,7 @@ _Related_

### lockPostAutosaving

Returns an action object used to signal that post autosaving is locked.
Action that locks post autosaving.

_Usage_

Expand All @@ -1130,7 +1128,7 @@ _Returns_

### lockPostSaving

Returns an action object used to signal that post saving is locked.
Action that locks post saving.

_Usage_

Expand Down Expand Up @@ -1213,8 +1211,7 @@ _Related_

### redo

Returns an action object used in signalling that undo history should
restore last popped state.
Action that restores last popped state in undo history.

### refreshPost

Expand Down Expand Up @@ -1270,7 +1267,7 @@ post has been received, either by initialization or save.

### savePost

Action generator for saving the current post in the editor.
Action for saving the current post in the editor.

_Parameters_

Expand Down Expand Up @@ -1362,15 +1359,15 @@ _Related_

### trashPost

Action generator for trashing the current post in the editor.
Action for trashing the current post in the editor.

### undo

Returns an action object used in signalling that undo history should pop.
Action that pops a record from undo history and undoes the edit.

### unlockPostAutosaving

Returns an action object used to signal that post autosaving is unlocked.
Action that unlocks post autosaving.

_Usage_

Expand All @@ -1387,7 +1384,7 @@ _Returns_

### unlockPostSaving

Returns an action object used to signal that post saving is unlocked.
Action that unlocks post saving.

_Usage_

Expand Down Expand Up @@ -1437,7 +1434,7 @@ _Returns_

### updatePostLock

Returns an action object used to lock the editor.
Action that locks the editor.

_Parameters_

Expand Down
1 change: 0 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/core-data/src/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -466,7 +466,7 @@ export const saveEntityRecord = (
// so the client just sends and receives objects.
const currentUser = select.getCurrentUser();
const currentUserId = currentUser ? currentUser.id : undefined;
const autosavePost = resolveSelect.getAutosave(
const autosavePost = await resolveSelect.getAutosave(
persistedRecord.type,
persistedRecord.id,
currentUserId
Expand Down
1 change: 0 additions & 1 deletion packages/editor/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
"@wordpress/compose": "file:../compose",
"@wordpress/core-data": "file:../core-data",
"@wordpress/data": "file:../data",
"@wordpress/data-controls": "file:../data-controls",
"@wordpress/date": "file:../date",
"@wordpress/deprecated": "file:../deprecated",
"@wordpress/element": "file:../element",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@ import { store as noticesStore } from '@wordpress/notices';
* Internal dependencies
*/
import AutosaveMonitor from '../autosave-monitor';
import { localAutosaveGet, localAutosaveClear } from '../../store/controls';
import {
localAutosaveGet,
localAutosaveClear,
} from '../../store/local-autosave';
import { store as editorStore } from '../../store';

const requestIdleCallback = window.requestIdleCallback
Expand Down
Loading

0 comments on commit 0bad51e

Please sign in to comment.