Skip to content

Fix: Collapsed state between redraws#703

Merged
BeyondEvil merged 1 commit intopytest-dev:masterfrom
BeyondEvil:beyondevil/store-collapsed-state
Jul 28, 2023
Merged

Fix: Collapsed state between redraws#703
BeyondEvil merged 1 commit intopytest-dev:masterfrom
BeyondEvil:beyondevil/store-collapsed-state

Conversation

@BeyondEvil
Copy link
Copy Markdown
Contributor

No description provided.

@BeyondEvil BeyondEvil force-pushed the beyondevil/store-collapsed-state branch from 8b3be90 to 18c7030 Compare July 28, 2023 12:00
@BeyondEvil BeyondEvil marked this pull request as ready for review July 28, 2023 12:00
@BeyondEvil BeyondEvil merged commit af4c653 into pytest-dev:master Jul 28, 2023
@BeyondEvil BeyondEvil deleted the beyondevil/store-collapsed-state branch July 28, 2023 15:28
const collapsed = collapsedCategories.includes(test.result.toLowerCase())
const id = `test_${index}`
if (collapsed) {
collapsedIds.push(id)
Copy link
Copy Markdown
Collaborator

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)

Copy link
Copy Markdown
Collaborator

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))

Copy link
Copy Markdown
Contributor Author

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.

}

get initialSort() {
return this.data.initialSort
Copy link
Copy Markdown
Collaborator

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants