diff --git a/packages/internal/store/src/action/store.ts b/packages/internal/store/src/action/store.ts index 2e005c4ff..fd03c09c5 100644 --- a/packages/internal/store/src/action/store.ts +++ b/packages/internal/store/src/action/store.ts @@ -1,5 +1,6 @@ import type { ActionConditionIndex, + ActionFilter, ActionFilterItem, ActionId, ActionModel, @@ -27,7 +28,18 @@ class ActionSyncService { const res = await apiClient().actions.$get() if (res.data) { actionActions.updateRules( - (res.data.rules ?? []).map((rule, index) => ({ ...rule, index })) as any, + (res.data.rules ?? []).map((rule, index) => { + const { condition } = rule + // fix old data + const finalCondition = + condition.length === 0 || Array.isArray(condition[0]) ? condition : [condition] + + return { + ...rule, + condition: finalCondition as ActionFilter, + index, + } + }), ) actionActions.setDirty(false)