Refactor actions (#8761)

Closes #8737 
- Refactored actions by creating hooks to add the possibility to
register actions programatically.
- Small fixes from #8610 review
- Fixed shortcuts display inside the command menu
- Removed `actionMenuEntriesComponentState` and introduced
`actionMenuEntriesComponentSelector`
This commit is contained in:
Raphaël Bosi
2024-11-27 15:08:27 +01:00
committed by GitHub
parent 0d6a6ec678
commit a9cb1e9b0d
40 changed files with 682 additions and 479 deletions

View File

@ -1,3 +1,4 @@
import { CONTEXT_STORE_INSTANCE_ID_DEFAULT_VALUE } from '@/context-store/constants/ContextStoreInstanceIdDefaultValue';
import { ContextStoreComponentInstanceContext } from '@/context-store/states/contexts/ContextStoreComponentInstanceContext';
import { mainContextStoreComponentInstanceIdState } from '@/context-store/states/mainContextStoreComponentInstanceId';
import { useContext, useEffect } from 'react';
@ -11,10 +12,14 @@ export const MainContextStoreComponentInstanceIdSetterEffect = () => {
const context = useContext(ContextStoreComponentInstanceContext);
useEffect(() => {
setMainContextStoreComponentInstanceId(context?.instanceId ?? 'app');
setMainContextStoreComponentInstanceId(
context?.instanceId ?? CONTEXT_STORE_INSTANCE_ID_DEFAULT_VALUE,
);
return () => {
setMainContextStoreComponentInstanceId('app');
setMainContextStoreComponentInstanceId(
CONTEXT_STORE_INSTANCE_ID_DEFAULT_VALUE,
);
};
}, [context, setMainContextStoreComponentInstanceId]);