-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
EZP-30072: As an editor I would like to see the content tree state restored after reloading a page #144
Conversation
fa02300
to
ba4bd68
Compare
7d6f0a4
to
e78463b
Compare
Ready for review - ping @dew326 |
const mapChildrenToSubitemsDeep = (tree) => { | ||
const parsedSubtree = []; | ||
|
||
for (const subtree of tree) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With map
this would be simpler.
const mapChildrenToSubitems = (location) => { | ||
location.totalSubitemsCount = location.totalChildrenCount; | ||
location.subitems = location.children; | ||
location.totalSubitemsCount = location.totalChildrenCount; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why one more time?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Upps, mistake.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe after rebase.
nodes: subtree, | ||
}, | ||
}), | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not needed
return; | ||
} | ||
|
||
const index = parentSubtree.children.findIndex((element) => parseInt(element.locationId, 10) === parseInt(path[1], 10)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The other element.locationId
doesn't have parseInt
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yup, it can be removed.
localStorage.setItem(KEY_CONTENT_TREE_SUBTREE, JSON.stringify(this.subtree)); | ||
} | ||
|
||
findParentSubtree(subtree, item, path) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
item
seems unused
9f7cedd
to
435e76b
Compare
ping @dew326 - I applied fixes in last commit. :) |
|
||
return mapChildrenToSubitems(location); | ||
}) | ||
.then(callback) | ||
.catch(showErrorNotification); | ||
// .catch(showErrorNotification); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why?
JIRA: https://jira.ez.no/browse/EZP-30072
Requires: ezsystems/ezplatform-admin-ui#857
Screenshots
Restoring tree state after page refresh:
Resizing Content Tree container according to windows size & scroll: