Closed HECHONG999 closed 8 months ago
在派生函数内使用到state里可选链state,如 state.currentTaskView?.taskFieldVisibleConfig,依赖不会收集可选链后的状态 taskFieldVisibleConfig 的状态不会被收集 In the derived function, use the optional chain state in state, such as state.currentTaskView?.taskFieldVisibleConfig. The dependency will not collect the status of taskFieldVisibleConfig after the optional chain.
在派生函数内使用到state里可选链state,如 state.currentTaskView?.taskFieldVisibleConfig,依赖不会收集可选链后的状态 taskFieldVisibleConfig 的状态不会被收集
In the derived function, use the optional chain state in state, such as state.currentTaskView?.taskFieldVisibleConfig. The dependency will not collect the status of taskFieldVisibleConfig after the optional chain.
export const viewDisplayTaskFields = (): TTaskFieldVisibleConfig[] => { const taskFieldVisibleConfig = state.currentTaskView?.taskFieldVisibleConfig || []; const taskTypeArray = state.taskTypeList || []; debugger; return X }
setProjectInfo((draft) => { const taskTypeIndex = draft.currentTaskView?.taskFieldVisibleConfig?.findIndex( (item) => item.taskType.id === projectInfo.currentTaskType?.id, ); if (taskTypeIndex !== undefined && fieldIndex !== undefined && draft.currentTaskView) { draft.currentTaskView.taskFieldVisibleConfig[taskTypeIndex].taskType.boardProperties[fieldIndex].visible = true; // resolve 手动更新一下可选链前的状态 draft.currentTaskView = { ...draft.currentTaskView }; } });
fixed at >= 4.2.0
4.2.0
问题描述:
示例
临时解决