Skip to content

Split AlertTable into smaller components#2732

Merged
robertbrignull merged 23 commits intomainfrom
robertbrignull/AlertTable-decompose
Aug 22, 2023
Merged

Split AlertTable into smaller components#2732
robertbrignull merged 23 commits intomainfrom
robertbrignull/AlertTable-decompose

Conversation

@robertbrignull
Copy link
Copy Markdown
Contributor

Refactors the rendering in AlertTable. Previous it was multiple nested foreach loops adding components to a rows array from multiple places, including the rendering of zero results or truncated results. As of this PR it's a series of hierarchical components.

Each small change is done as a separate commit, so theoretically you should be able to follow along with them. Or it may be easier to review the end result on its own if that's what you prefer.

I've tried to test manually and as far as I can tell, everything looks and behaves exactly the same as before 🎉

Checklist

  • CHANGELOG.md has been updated to incorporate all user visible changes made by this pull request.
  • Issues have been created for any UI or other user-facing changes made by this pull request.
  • [Maintainers only] If this pull request makes user-facing changes that require documentation changes, open a corresponding docs pull request in the github/codeql repo and add the ready-for-doc-review label there.

@robertbrignull robertbrignull requested a review from a team August 21, 2023 13:53
@robertbrignull robertbrignull requested a review from a team as a code owner August 21, 2023 13:53
Copy link
Copy Markdown
Contributor

@charisk charisk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM in general although I can't promise I've gone through every line and character change since there is a fair bit of code moving around. I think there are a couple of cases where we're using useMemo when we should be using useCallback (unless I misread the code) but otherwise LGTM!

Thanks for making this better gradually - it's great to see the individual components now.

Comment thread extensions/ql-vscode/src/view/results/AlertTablePathNodeRow.tsx Outdated
Comment thread extensions/ql-vscode/src/view/results/AlertTablePathRow.tsx Outdated
Comment thread extensions/ql-vscode/src/view/results/AlertTableResultRow.tsx Outdated
@robertbrignull
Copy link
Copy Markdown
Contributor Author

Thank you @charisk for the review. For the handleDropdownClick methods it was a simple case of switching the useCallback. For the handleSarifLocationClicked methods, it required doing the same adjustment to updateSelectionCallback that I already did to toggle, so it isn't using "nested methods". Thank you for pointing out that improvement.

@robertbrignull robertbrignull merged commit 5fc3424 into main Aug 22, 2023
@robertbrignull robertbrignull deleted the robertbrignull/AlertTable-decompose branch August 22, 2023 11:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants