(state: IReduxState)
| 29 | * Pass in the current `state`, and return the reference relationship management instance of the computed field in the current state. |
| 30 | */ |
| 31 | export const getComputeRefManager = (state: IReduxState) => { |
| 32 | const refMapCache = computeCache.get(COMPUTE_REF_MAP_CACHE_KEY); |
| 33 | // The server does not have a mechanism to update the refMap, so every time it gets the latest one. cannot be retrieved from the cache. |
| 34 | if (refMapCache && !isServer()) { |
| 35 | const computeRefManager = new ComputeRefManager(refMapCache.refMap, refMapCache.reRefMap); |
| 36 | return computeRefManager; |
| 37 | } |
| 38 | const computeRefManager = new ComputeRefManager(); |
| 39 | Object.keys(state.datasheetMap).forEach(datasheetId => { |
| 40 | const currSnapshot = getSnapshot(state, datasheetId); |
| 41 | const fieldMap = currSnapshot?.meta.fieldMap; |
| 42 | if (fieldMap) { |
| 43 | |
| 44 | computeRefManager.computeRefMap(fieldMap, datasheetId, state); |
| 45 | } |
| 46 | }); |
| 47 | return computeRefManager; |
| 48 | }; |
no test coverage detected