|
1 | 1 | import React, {useState, useRef, useMemo, useEffect} from 'react';
|
2 |
| -import {equals, concat, includes, toPairs} from 'ramda'; |
| 2 | +import {equals, concat, includes, toPairs, any} from 'ramda'; |
3 | 3 | import PropTypes from 'prop-types';
|
4 | 4 |
|
5 | 5 | import GraphSpinner from '../fragments/Loading/spinners/GraphSpinner.jsx';
|
@@ -35,19 +35,21 @@ const loadingSelector = (componentPath, targetComponents) => state => {
|
35 | 35 | stringPath = stringPath.substring(0, stringPath.length - 1);
|
36 | 36 | const loadingChildren = toPairs(state.loading).reduce(
|
37 | 37 | (acc, [path, load]) => {
|
38 |
| - if (path.startsWith(stringPath)) { |
39 |
| - if (targetComponents) { |
40 |
| - const target = targetComponents[load.id]; |
41 |
| - if (!target) { |
42 |
| - return acc; |
43 |
| - } |
44 |
| - if (Array.isArray(target)) { |
45 |
| - if (!includes(load.property, target)) { |
46 |
| - return acc; |
| 38 | + if (path.startsWith(stringPath) && load.length) { |
| 39 | + if ( |
| 40 | + targetComponents && |
| 41 | + !any(l => { |
| 42 | + const target = targetComponents[l.id]; |
| 43 | + if (!target) { |
| 44 | + return false; |
47 | 45 | }
|
48 |
| - } else if (load.property !== target) { |
49 |
| - return acc; |
50 |
| - } |
| 46 | + if (Array.isArray(target)) { |
| 47 | + return includes(l.property, target); |
| 48 | + } |
| 49 | + return l.property === target; |
| 50 | + }, load) |
| 51 | + ) { |
| 52 | + return acc; |
51 | 53 | }
|
52 | 54 | return concat(acc, load);
|
53 | 55 | }
|
|
0 commit comments