Skip to content

Commit

Permalink
Remove revisions store methods. We don't need them until #49974 lands.
Browse files Browse the repository at this point in the history
  • Loading branch information
ramonjd committed Apr 21, 2023
1 parent a3ff5f9 commit 6a7e651
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 90 deletions.
22 changes: 0 additions & 22 deletions packages/core-data/src/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -193,28 +193,6 @@ export function __experimentalReceiveThemeGlobalStyleVariations(
};
}

/**
* Returns an action object used in signalling that the theme global styles custom post type (CPT) revisions have been received.
* Ignored from documentation as it's internal to the data store.
*
* @ignore
*
* @param {number} currentId The post id.
* @param {Array} revisions The global styles revisions.
*
* @return {Object} Action object.
*/
export function __experimentalReceiveThemeGlobalStyleRevisions(
currentId,
revisions
) {
return {
type: 'RECEIVE_THEME_GLOBAL_STYLE_REVISIONS',
currentId,
revisions,
};
}

/**
* Returns an action object used in signalling that the index has been received.
*
Expand Down
21 changes: 0 additions & 21 deletions packages/core-data/src/reducer.js
Original file line number Diff line number Diff line change
Expand Up @@ -183,26 +183,6 @@ export function themeGlobalStyleVariations( state = {}, action ) {
return state;
}

/**
* Reducer managing the theme global styles revisions.
*
* @param {Record<string, object>} state Current state.
* @param {Object} action Dispatched action.
*
* @return {Record<string, object>} Updated state.
*/
export function themeGlobalStyleRevisions( state = {}, action ) {
switch ( action.type ) {
case 'RECEIVE_THEME_GLOBAL_STYLE_REVISIONS':
return {
...state,
[ action.currentId ]: action.revisions,
};
}

return state;
}

/**
* Higher Order Reducer for a given entity config. It supports:
*
Expand Down Expand Up @@ -669,7 +649,6 @@ export default combineReducers( {
currentGlobalStyles,
currentUser,
themeGlobalStyleVariations,
themeGlobalStyleRevisions,
themeBaseGlobalStyles,
taxonomies,
entities,
Expand Down
29 changes: 0 additions & 29 deletions packages/core-data/src/resolvers.js
Original file line number Diff line number Diff line change
Expand Up @@ -500,35 +500,6 @@ export const __experimentalGetCurrentThemeGlobalStylesVariations =
);
};

export const __experimentalGetCurrentThemeGlobalStylesRevisions =
() =>
async ( { resolveSelect, dispatch } ) => {
const currentGlobalStyles =
await resolveSelect.__experimentalGetCurrentGlobalStyles();
const revisionsURL =
currentGlobalStyles?._links?.[ 'version-history' ]?.[ 0 ]?.href;
if ( revisionsURL ) {
const revisions = await apiFetch( {
url: revisionsURL,
} );
dispatch.__experimentalReceiveThemeGlobalStyleRevisions(
currentGlobalStyles?.id,
revisions
);
}
};

__experimentalGetCurrentThemeGlobalStylesRevisions.shouldInvalidate = (
action
) => {
return (
action.type === 'SAVE_ENTITY_RECORD_FINISH' &&
action.kind === 'root' &&
! action.error &&
action.name === 'globalStyles'
);
};

export const getBlockPatterns =
() =>
async ( { dispatch } ) => {
Expand Down
18 changes: 0 additions & 18 deletions packages/core-data/src/selectors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ export interface State {
entities: EntitiesState;
themeBaseGlobalStyles: Record< string, Object >;
themeGlobalStyleVariations: Record< string, string >;
themeGlobalStyleRevisions: Record< number, Object >;
undo: UndoState;
userPermissions: Record< string, boolean >;
users: UserState;
Expand Down Expand Up @@ -1224,23 +1223,6 @@ export function __experimentalGetCurrentThemeGlobalStylesVariations(
return state.themeGlobalStyleVariations[ currentTheme.stylesheet ];
}

/**
* Returns the revisions of the current global styles theme.
*
* @param state Data state.
*
* @return The current global styles.
*/
export function __experimentalGetCurrentThemeGlobalStylesRevisions(
state: State
): GlobalStyles | null {
const currentGlobalStyles = __experimentalGetCurrentGlobalStyles( state );
if ( ! currentGlobalStyles?.id ) {
return null;
}
return state.themeGlobalStyleRevisions[ currentGlobalStyles.id ];
}

/**
* Retrieve the list of registered block patterns.
*
Expand Down

0 comments on commit 6a7e651

Please sign in to comment.