From 2576f65e6fd2966a54550db0f5ba60d91ee1d6a6 Mon Sep 17 00:00:00 2001 From: George Mamadashvili Date: Fri, 22 Aug 2025 13:12:35 +0400 Subject: [PATCH] Core Data: Remove unused reducers --- packages/core-data/src/reducer.js | 42 -------------------------- packages/core-data/src/test/reducer.js | 22 -------------- 2 files changed, 64 deletions(-) diff --git a/packages/core-data/src/reducer.js b/packages/core-data/src/reducer.js index 9748355fc5caf6..75b3ca35130eb7 100644 --- a/packages/core-data/src/reducer.js +++ b/packages/core-data/src/reducer.js @@ -19,29 +19,6 @@ import { rootEntitiesConfig, DEFAULT_ENTITY_KEY } from './entities'; /** @typedef {import('./types').AnyFunction} AnyFunction */ -/** - * Reducer managing terms state. Keyed by taxonomy slug, the value is either - * undefined (if no request has been made for given taxonomy), null (if a - * request is in-flight for given taxonomy), or the array of terms for the - * taxonomy. - * - * @param {Object} state Current state. - * @param {Object} action Dispatched action. - * - * @return {Object} Updated state. - */ -export function terms( state = {}, action ) { - switch ( action.type ) { - case 'RECEIVE_TERMS': - return { - ...state, - [ action.taxonomy ]: action.terms, - }; - } - - return state; -} - /** * Reducer managing authors state. Keyed by id. * @@ -92,23 +69,6 @@ export function currentUser( state = {}, action ) { return state; } -/** - * Reducer managing taxonomies. - * - * @param {Object} state Current state. - * @param {Object} action Dispatched action. - * - * @return {Object} Updated state. - */ -export function taxonomies( state = [], action ) { - switch ( action.type ) { - case 'RECEIVE_TAXONOMIES': - return action.taxonomies; - } - - return state; -} - /** * Reducer managing the current theme. * @@ -648,7 +608,6 @@ export function registeredPostMeta( state = {}, action ) { } export default combineReducers( { - terms, users, currentTheme, currentGlobalStylesId, @@ -656,7 +615,6 @@ export default combineReducers( { themeGlobalStyleVariations, themeBaseGlobalStyles, themeGlobalStyleRevisions, - taxonomies, entities, editsReference, undoManager, diff --git a/packages/core-data/src/test/reducer.js b/packages/core-data/src/test/reducer.js index d5d5bc5c8692fa..e46aa0cdacc621 100644 --- a/packages/core-data/src/test/reducer.js +++ b/packages/core-data/src/test/reducer.js @@ -7,7 +7,6 @@ import deepFreeze from 'deep-freeze'; * Internal dependencies */ import { - terms, entities, embedPreviews, userPermissions, @@ -15,27 +14,6 @@ import { currentUser, } from '../reducer'; -describe( 'terms()', () => { - it( 'returns an empty object by default', () => { - const state = terms( undefined, {} ); - - expect( state ).toEqual( {} ); - } ); - - it( 'returns with received terms', () => { - const originalState = deepFreeze( {} ); - const state = terms( originalState, { - type: 'RECEIVE_TERMS', - taxonomy: 'categories', - terms: [ { id: 1 } ], - } ); - - expect( state ).toEqual( { - categories: [ { id: 1 } ], - } ); - } ); -} ); - describe( 'entities', () => { // See also unit tests at `queried-data/test/reducer.js`, which are more // thorough in testing the behavior of what is tracked here as the