-
Notifications
You must be signed in to change notification settings - Fork 29
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
Refactor experiment table branch data #4364
Conversation
export const collectBranchWithRows = ( | ||
rows: Row<Experiment>[] | ||
): [string | typeof WORKSPACE_BRANCH, Row<Experiment>[]][] => { | ||
const branchesWithRows: [ |
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.
[F] Usually I would have just used an object here but you can't key an object using undefined
| null
so I opted for this slightly wacky collection pattern.
@@ -52,11 +49,9 @@ export const TableContent: React.FC<TableContentProps> = ({ | |||
|
|||
return ( | |||
<> | |||
{branches.map(branch => { | |||
const branchRows = rows.filter(row => row.original.branch === branch) |
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.
[F] probably just because the focus is on efficiency this week but I decided that we should get this collection done in a single loop.
2ce43e0
to
49c7273
Compare
8edcf15
to
0b5b22a
Compare
0b5b22a
to
4d4e189
Compare
4d4e189
to
571d924
Compare
Code Climate has analyzed commit 571d924 and detected 0 issues on this pull request. The test coverage on the diff in this pull request is 92.3% (85% is the threshold). This pull request will bring the total coverage in the repository to 95.2%. View more on Code Climate. |
2/2
main
<- #4363 <- thisThis PR refactors the way that branch data is passed from the extension to the experiments webview. The main reason for the change is because of a bug surfaced when demoing the previous PR in that filtered branches would not show up as selected under the old logic.
Turns out the mapping of rows back to branches in the experiments webview was a little bit brittle. I have broken it on a few occasions and struggled to get it back working. The idea is to stabilise the logic by keeping it contained in a couple of places and slightly improve efficiency.
Demo (bug from previous PR)
Screen.Recording.2023-07-27.at.5.29.18.pm.mov