-
Notifications
You must be signed in to change notification settings - Fork 56
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-32248: Retain content tree state #1679
Conversation
@@ -26,10 +28,46 @@ export default class ContentTree extends Component { | |||
this.clearDocumentResizingListeners(); | |||
} | |||
|
|||
componentDidMount() { | |||
this.containerSrollRef.addEventListener('scroll', (event) => { |
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.
this.containerSrollRef.addEventListener('scroll', (event) => { | |
this.containerScrollRef.addEventListener('scroll', (event) => { |
@@ -26,10 +28,46 @@ export default class ContentTree extends Component { | |||
this.clearDocumentResizingListeners(); | |||
} | |||
|
|||
componentDidMount() { | |||
this.containerSrollRef.addEventListener('scroll', (event) => { | |||
clearTimeout(this.scrollTimeout); |
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.
clearTimeout(this.scrollTimeout); | |
window.clearTimeout(this.scrollTimeout); |
To show that this is from window object
this.containerSrollRef.addEventListener('scroll', (event) => { | ||
clearTimeout(this.scrollTimeout); | ||
|
||
this.scrollTimeout = setTimeout( |
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.
this.scrollTimeout = setTimeout( | |
this.scrollTimeout = window.setTimeout( |
document.body.dispatchEvent(new CustomEvent('ez-content-tree-resized')); | ||
} | ||
|
||
if (this.props.items.length && !this.scrollPositionSet) { |
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.
if (this.props.items.length && !this.scrollPositionSet) { | |
if (this.props.items && this.props.items.length && !this.scrollPositionSet) { |
?
|
||
saveConfig(id, value) { | ||
const data = JSON.parse(window.localStorage.getItem('ez-content-tree-state') || '{}'); | ||
const userId = window.eZ.helpers.user.getId(); |
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.
I don't think it should be taken from window object. To the content tree userId is passed as a prop. It would be better to keep the consistency of data.
Checklist: