Skip to content

Commit

Permalink
Framework: Adopt Ducks pattern for state shape
Browse files Browse the repository at this point in the history
  • Loading branch information
aduth committed Nov 20, 2017
1 parent 21b307f commit 4fa0f08
Show file tree
Hide file tree
Showing 44 changed files with 6,792 additions and 6,160 deletions.
4 changes: 2 additions & 2 deletions editor/components/post-permalink/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { Dashicon, ClipboardButton, Button } from '@wordpress/components';
* Internal Dependencies
*/
import './style.scss';
import { isEditedPostNew, getEditedPostAttribute } from '../../state/selectors';
import { isCurrentPostNew, getEditedPostAttribute } from '../../state/selectors';

class PostPermalink extends Component {
constructor() {
Expand Down Expand Up @@ -66,7 +66,7 @@ class PostPermalink extends Component {
export default connect(
( state ) => {
return {
isNew: isEditedPostNew( state ),
isNew: isCurrentPostNew( state ),
link: getEditedPostAttribute( state, 'link' ),
};
}
Expand Down
8 changes: 4 additions & 4 deletions editor/components/post-preview-button/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ import { _x } from '@wordpress/i18n';
* Internal dependencies
*/
import {
getEditedPostPreviewLink,
getCurrentPostPreviewLink,
getEditedPostAttribute,
isEditedPostDirty,
isEditedPostNew,
isCurrentPostNew,
isEditedPostSaveable,
} from '../../state/selectors';
import { autosave } from '../../state/actions';
Expand Down Expand Up @@ -117,9 +117,9 @@ export class PostPreviewButton extends Component {
export default connect(
( state ) => ( {
postId: state.currentPost.id,
link: getEditedPostPreviewLink( state ),
link: getCurrentPostPreviewLink( state ),
isDirty: isEditedPostDirty( state ),
isNew: isEditedPostNew( state ),
isNew: isCurrentPostNew( state ),
isSaveable: isEditedPostSaveable( state ),
modified: getEditedPostAttribute( state, 'modified' ),
} ),
Expand Down
4 changes: 2 additions & 2 deletions editor/components/post-saved-state/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import { Dashicon, Button } from '@wordpress/components';
import './style.scss';
import { editPost, savePost } from '../../state/actions';
import {
isEditedPostNew,
isCurrentPostNew,
isCurrentPostPublished,
isEditedPostDirty,
isSavingPost,
Expand Down Expand Up @@ -68,7 +68,7 @@ export function PostSavedState( { isNew, isPublished, isDirty, isSaving, isSavea
export default connect(
( state ) => ( {
post: getCurrentPost( state ),
isNew: isEditedPostNew( state ),
isNew: isCurrentPostNew( state ),
isPublished: isCurrentPostPublished( state ),
isDirty: isEditedPostDirty( state ),
isSaving: isSavingPost( state ),
Expand Down
4 changes: 2 additions & 2 deletions editor/components/post-trash/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { Button, Dashicon } from '@wordpress/components';
*/
import './style.scss';
import {
isEditedPostNew,
isCurrentPostNew,
getCurrentPostId,
getCurrentPostType,
} from '../../state/selectors';
Expand All @@ -38,7 +38,7 @@ function PostTrash( { isNew, postId, postType, ...props } ) {
export default connect(
( state ) => {
return {
isNew: isEditedPostNew( state ),
isNew: isCurrentPostNew( state ),
postId: getCurrentPostId( state ),
postType: getCurrentPostType( state ),
};
Expand Down
2 changes: 1 addition & 1 deletion editor/sidebar/discussion-panel/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { PanelBody, PanelRow } from '@wordpress/components';
* Internal Dependencies
*/
import { PostComments, PostPingbacks } from '../../components';
import { isEditorSidebarPanelOpened } from '../../state/selectors';
import { isEditorSidebarPanelOpened } from '../../state/preferences';
import { toggleSidebarPanel } from '../../state/actions';

/**
Expand Down
4 changes: 2 additions & 2 deletions editor/sidebar/post-trash/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { PanelRow } from '@wordpress/components';
*/
import './style.scss';
import { PostTrash as PostTrashLink } from '../../components';
import { isEditedPostNew, getCurrentPostId } from '../../state/selectors';
import { isCurrentPostNew, getCurrentPostId } from '../../state/selectors';

function PostTrash( { isNew, postId } ) {
if ( isNew || ! postId ) {
Expand All @@ -30,7 +30,7 @@ function PostTrash( { isNew, postId } ) {
export default connect(
( state ) => {
return {
isNew: isEditedPostNew( state ),
isNew: isCurrentPostNew( state ),
postId: getCurrentPostId( state ),
};
},
Expand Down
Loading

0 comments on commit 4fa0f08

Please sign in to comment.