Reset array limit when not expanded

This commit is contained in:
josdejong 2020-06-03 08:24:06 +02:00
parent 0da0d14b3d
commit 44eb417e4f
1 changed files with 5 additions and 4 deletions

View File

@ -44,14 +44,15 @@ export function syncState (document, state = undefined, path, expand, forceRefre
if (Array.isArray(document)) {
const updatedState = []
updatedState[STATE_LIMIT] = state
? state[STATE_LIMIT]
: DEFAULT_LIMIT
updatedState[STATE_EXPANDED] = (state && !forceRefresh)
? state[STATE_EXPANDED]
: 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]) {
for (let i = 0; i < Math.min(document.length, updatedState[STATE_LIMIT]); i++) {
const childDocument = document[i]