Consistent storeInit and error handling logic

This commit is contained in:
Philipp Stracker 2025-01-21 13:32:03 +01:00
parent 2818fd5d76
commit 7fad70d6e5
No known key found for this signature in database
7 changed files with 67 additions and 33 deletions

View file

@ -9,6 +9,12 @@ import * as hooks from './hooks';
import { resolvers } from './resolvers';
import { controls } from './controls';
/**
* Initializes and registers the settings store with WordPress data layer.
* Combines custom controls with WordPress data controls.
*
* @return {boolean} True if initialization succeeded, false otherwise.
*/
export const initStore = () => {
const store = createReduxStore( STORE_NAME, {
reducer,
@ -19,6 +25,8 @@ export const initStore = () => {
} );
register( store );
return Boolean( wp.data.select( STORE_NAME ) );
};
export { hooks, selectors, STORE_NAME };