-
Notifications
You must be signed in to change notification settings - Fork 241
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
Fix: Collapsed state between redraws #703
Fix: Collapsed state between redraws #703
Conversation
8b3be90
to
18c7030
Compare
const tests = Object.values(data.tests).flat().map((test, index) => { | ||
const collapsed = collapsedCategories.includes(test.result.toLowerCase()) | ||
const id = `test_${index}` | ||
if (collapsed) { | ||
collapsedIds.push(id) |
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'd avoid updating the collapsedIds collection in the map.
Instead I would do it after the construction of collapsed collection:
const collapsedIds = collapsed.map(({id}) => id)
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.
or even better:
setCollapsedIds(collapsed.map(({id}) => id))
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 actually had it that way at first. But thought it was better to not do two iterations over the same collection.
@@ -47,6 +53,10 @@ class DataManager { | |||
get environment() { | |||
return this.renderData.environment | |||
} | |||
|
|||
get initialSort() { | |||
return this.data.initialSort |
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.
return [...this.data.initialSort]
This prevents data.initialSort from becoming compromised by being updated by reference.
No description provided.