diff --git a/plugins/wazuh-core/public/services/state/hooks/creator.ts b/plugins/wazuh-core/public/services/state/hooks/creator.ts index 998d23fb20..f8417e4ecb 100644 --- a/plugins/wazuh-core/public/services/state/hooks/creator.ts +++ b/plugins/wazuh-core/public/services/state/hooks/creator.ts @@ -4,7 +4,7 @@ import { State } from '../types'; export const createHooks = ({ state }: { state: State }) => { function useStateContainer(name: string) { const value: T = useObservable( - state.getStateContainer(name).updater$, + state.getStateContainer(name)?.updater$, state.get(name), ); diff --git a/plugins/wazuh-core/public/services/state/types.ts b/plugins/wazuh-core/public/services/state/types.ts index d80347ca1a..a1a309de61 100644 --- a/plugins/wazuh-core/public/services/state/types.ts +++ b/plugins/wazuh-core/public/services/state/types.ts @@ -27,6 +27,7 @@ export interface State< get: (name: string) => any; set: (name: string, value: any) => any; remove: (name: string) => any; + getStateContainer: (name: string) => StateContainer | undefined; register: (name: string, value: StateContainer) => any; subscribe: ( name: string,