Reset array limit when not expanded
This commit is contained in:
parent
0da0d14b3d
commit
44eb417e4f
|
@ -44,14 +44,15 @@ export function syncState (document, state = undefined, path, expand, forceRefre
|
||||||
if (Array.isArray(document)) {
|
if (Array.isArray(document)) {
|
||||||
const updatedState = []
|
const updatedState = []
|
||||||
|
|
||||||
updatedState[STATE_LIMIT] = state
|
|
||||||
? state[STATE_LIMIT]
|
|
||||||
: DEFAULT_LIMIT
|
|
||||||
|
|
||||||
updatedState[STATE_EXPANDED] = (state && !forceRefresh)
|
updatedState[STATE_EXPANDED] = (state && !forceRefresh)
|
||||||
? state[STATE_EXPANDED]
|
? state[STATE_EXPANDED]
|
||||||
: expand(path)
|
: expand(path)
|
||||||
|
|
||||||
|
// note that we reset the limit when the state is not expanded
|
||||||
|
updatedState[STATE_LIMIT] = (state && updatedState[STATE_EXPANDED])
|
||||||
|
? state[STATE_LIMIT]
|
||||||
|
: DEFAULT_LIMIT
|
||||||
|
|
||||||
if (updatedState[STATE_EXPANDED]) {
|
if (updatedState[STATE_EXPANDED]) {
|
||||||
for (let i = 0; i < Math.min(document.length, updatedState[STATE_LIMIT]); i++) {
|
for (let i = 0; i < Math.min(document.length, updatedState[STATE_LIMIT]); i++) {
|
||||||
const childDocument = document[i]
|
const childDocument = document[i]
|
||||||
|
|
Loading…
Reference in New Issue