Command menu follow up improvements (#16007)
Co-authored-by: Devessier <baptiste@devessier.fr>
This commit is contained in:
+16
-1
@@ -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],
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user