Fix bugs tied to jotai migration (#18227)

Fixing a few bugs:
- CommandMenu not reactive
- Filtering on index view infinite loop
This commit is contained in:
Charles Bochet
2026-02-25 17:11:12 +01:00
committed by GitHub
parent 001c2097a3
commit 1fa55bfd02
31 changed files with 343 additions and 238 deletions
@@ -42,11 +42,21 @@ export const useCommandMenuCloseAnimationCompleteCleanup = () => {
const commandMenuCloseAnimationCompleteCleanup = useCallback(() => {
closeDropdown(COMMAND_MENU_CONTEXT_CHIP_GROUPS_DROPDOWN_ID);
// Snapshot values before any mutations (Jotai store.get is live, unlike
// Recoil snapshots which were immutable point-in-time captures).
const currentPage = store.get(commandMenuPageState.atom);
const targetedRecordsRule = store.get(
contextStoreTargetedRecordsRuleComponentState.atomFamily({
instanceId: COMMAND_MENU_COMPONENT_INSTANCE_ID,
}),
);
const morphItemsByPage = store.get(
commandMenuNavigationMorphItemsByPageState.atom,
);
resetContextStoreStates(COMMAND_MENU_COMPONENT_INSTANCE_ID);
resetContextStoreStates(COMMAND_MENU_PREVIOUS_COMPONENT_INSTANCE_ID);
const currentPage = store.get(commandMenuPageState.atom);
const isPageLayoutEditingPage =
currentPage === CommandMenuPages.PageLayoutWidgetTypeSelect ||
currentPage === CommandMenuPages.PageLayoutGraphTypeSelect ||
@@ -54,12 +64,6 @@ export const useCommandMenuCloseAnimationCompleteCleanup = () => {
currentPage === CommandMenuPages.PageLayoutTabSettings;
if (isPageLayoutEditingPage) {
const targetedRecordsRule = store.get(
contextStoreTargetedRecordsRuleComponentState.atomFamily({
instanceId: COMMAND_MENU_COMPONENT_INSTANCE_ID,
}),
);
if (
targetedRecordsRule.mode === 'selection' &&
targetedRecordsRule.selectedRecordIds.length === 1
@@ -113,10 +117,6 @@ export const useCommandMenuCloseAnimationCompleteCleanup = () => {
WorkflowLogicFunctionTabId.CODE,
);
const morphItemsByPage = store.get(
commandMenuNavigationMorphItemsByPageState.atom,
);
for (const [pageId, morphItems] of morphItemsByPage) {
store.set(
activeTabIdComponentState.atomFamily({