Command menu follow up improvements (#16007)

Co-authored-by: Devessier <baptiste@devessier.fr>
This commit is contained in:
Abdul Rahman
2025-11-24 15:53:08 +05:30
committed by GitHub
parent 607dc283d2
commit 834d354d46
10 changed files with 154 additions and 147 deletions
@@ -1,3 +1,5 @@
import { COMMAND_MENU_COMPONENT_INSTANCE_ID } from '@/command-menu/constants/CommandMenuComponentInstanceId';
import { isCommandMenuOpenedState } from '@/command-menu/states/isCommandMenuOpenedState';
import { MAIN_CONTEXT_STORE_INSTANCE_ID } from '@/context-store/constants/MainContextStoreInstanceId';
import { contextStoreIsPageInEditModeComponentState } from '@/context-store/states/contextStoreIsPageInEditModeComponentState';
import { PageLayoutComponentInstanceContext } from '@/page-layout/states/contexts/PageLayoutComponentInstanceContext';
@@ -24,11 +26,24 @@ export const useSetIsPageLayoutInEditMode = (pageLayoutIdFromProps: string) => {
);
const setIsPageLayoutInEditMode = useRecoilCallback(
({ set }) =>
({ set, snapshot }) =>
(value: boolean) => {
set(isPageLayoutInEditModeState, value);
set(contextStoreIsFullTabWidgetInEditModeState, value);
const isCommandMenuOpened = snapshot
.getLoadable(isCommandMenuOpenedState)
.getValue();
if (isCommandMenuOpened) {
set(
contextStoreIsPageInEditModeComponentState.atomFamily({
instanceId: COMMAND_MENU_COMPONENT_INSTANCE_ID,
}),
value,
);
}
},
[isPageLayoutInEditModeState, contextStoreIsFullTabWidgetInEditModeState],
);