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

@ -4,15 +4,14 @@ import { useRecoilComponentValueV2 } from '@/ui/utilities/state/component-state/
export const useContextStoreCurrentObjectMetadataIdOrThrow = (
instanceId?: string,
) => {
const contextStoreCurrentObjectMetadataIdComponent =
useRecoilComponentValueV2(
contextStoreCurrentObjectMetadataIdComponentState,
instanceId,
);
const contextStoreCurrentObjectMetadataId = useRecoilComponentValueV2(
contextStoreCurrentObjectMetadataIdComponentState,
instanceId,
);
if (!contextStoreCurrentObjectMetadataIdComponent) {
if (!contextStoreCurrentObjectMetadataId) {
throw new Error('contextStoreCurrentObjectMetadataIdComponent is not set');
}
return contextStoreCurrentObjectMetadataIdComponent;
return contextStoreCurrentObjectMetadataId;
};

View File

@ -6,7 +6,7 @@ import { useObjectMetadataItemById } from '@/object-metadata/hooks/useObjectMeta
import { useFindManyRecords } from '@/object-record/hooks/useFindManyRecords';
import { useRecoilComponentValueV2 } from '@/ui/utilities/state/component-state/hooks/useRecoilComponentValueV2';
export const useContextStoreSelectedRecords = ({
export const useFindManyRecordsSelectedInContextStore = ({
instanceId,
limit = 3,
}: {