(state, objects, id, mutationKey)
| 11 | } |
| 12 | |
| 13 | function selectObject(state, objects, id, mutationKey) { |
| 14 | if (!id || !_.has(objects, id)) { |
| 15 | return loadState(); |
| 16 | } |
| 17 | const obj = objects[id]; |
| 18 | const isLoadable = !obj.isError && !obj.isPending; |
| 19 | if (isLoadable) { |
| 20 | const globalMutationTimestamp = selectTimestamp(state); |
| 21 | const mutationTimestamp = selectTimestamp(state, mutationKey); |
| 22 | |
| 23 | const outdated = |
| 24 | obj.loadedAt && |
| 25 | (obj.loadedAt < globalMutationTimestamp || |
| 26 | obj.loadedAt < mutationTimestamp); |
| 27 | |
| 28 | obj.shouldLoad = obj.shouldLoad || outdated; |
| 29 | } |
| 30 | obj.shouldLoadDeep = obj.shouldLoad || (isLoadable && obj.shallow !== false); |
| 31 | return obj; |
| 32 | } |
| 33 | |
| 34 | function selectResult(state, query, expand, mutationKey) { |
| 35 | if (!query || !query.path) { |
no test coverage detected