Skip to content
This repository has been archived by the owner on Jul 2, 2024. It is now read-only.

DEVPROD-3049: Remove LeafyGreen column utils #2181

Merged
merged 15 commits into from
Dec 18, 2023

Conversation

sophstad
Copy link
Contributor

@sophstad sophstad commented Dec 7, 2023

DEVPROD-3049

Description

  • Remove getColumnTreeSelectFilterProps, getColumnInputFilterProps, and getColumnSortProps in favor of native react-table filter/sort props

Testing

  • Update Cypress tests

Copy link

cypress bot commented Dec 7, 2023

1 flaky test on run #14671 ↗︎

0 540 10 0 Flakiness 1

Details:

Merge branch 'main' of https://github.com/evergreen-ci/spruce into DEVPROD-3049
Project: Spruce Commit: 599a50ada5
Status: Passed Duration: 24:47 💡
Started: Dec 15, 2023 9:56 PM Ended: Dec 15, 2023 10:20 PM
Flakiness  cypress/integration/version/unscheduled_patch/configure_patch.ts • 1 flaky test

View Output Video

Test Artifacts
... > Checking Select All should check all task checkboxes when all of the task checkboxes unchecked Screenshots Video

Review all test suite changes for PR #2181 ↗︎

@sophstad sophstad requested a review from a team December 8, 2023 19:20
@sophstad sophstad marked this pull request as ready for review December 8, 2023 19:20
Comment on lines +6 to +9
retries: {
runMode: 3,
openMode: 0,
},
Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks!

@@ -31,7 +31,7 @@ describe("Task Duration Tab", () => {
cy.dataCy("leafygreen-table-row").should("have.length", 3);
cy.location("search").should(
"include",
"duration=DESC&page=0&statuses=running-umbrella,started,dispatched"
"duration=DESC&page=0&statuses=running-umbrella%2Cstarted%2Cdispatched"
Copy link
Contributor

Choose a reason for hiding this comment

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

This indicates to me that the query params aren't being properly uriencoded or that we are double encoding them.

Copy link
Contributor Author

@sophstad sophstad Dec 13, 2023

Choose a reason for hiding this comment

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

Well isn't the URL now being encoded, and it wasn't before? , is a reserved character in the URI specification which is why commas included our query param value should be encoded (as per these docs). query-string's .stringify() has encode = true as default, which is what ultimately applies the encoding.

},
[updateQueryParams]
);
const updateFilters = (filterState: ColumnFiltersState) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

I think at some point here we aren't properly transforming array values for filters which causes them to not be uriencoded correctly.

Comment on lines 43 to 44
const [filters, setFilters] = useState<ColumnFiltersState>(initialFilters);
const [sorting, setSorting] = useState<SortingState>(initialSort);
Copy link
Contributor

Choose a reason for hiding this comment

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

This seems like we are just duplicating the state that's already represented in the URL.

Copy link
Contributor

Choose a reason for hiding this comment

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

We should be able to just rely on the urlstate.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, react-table's handling of sort/filter is kinda weird... I went with this approach because it allows us to use the onColumnFilterChange/onSortingChange callbacks; using non "manual" filtering (to use react-table terminology) means that those functions are never called. But I changed approaches to have a useEffect hook update the query params instead.

Let me know what you think! If you like it I'll make a similar change to HostsTable.

@sophstad sophstad requested a review from khelif96 December 13, 2023 17:16
Copy link
Contributor

@khelif96 khelif96 left a comment

Choose a reason for hiding this comment

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

Looks great!

@sophstad sophstad requested a review from khelif96 December 15, 2023 21:38
Copy link
Contributor

@khelif96 khelif96 left a comment

Choose a reason for hiding this comment

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

💯

@khelif96 khelif96 merged commit c765193 into evergreen-ci:main Dec 18, 2023
5 of 6 checks passed
@sophstad sophstad deleted the DEVPROD-3049 branch January 3, 2024 16:21
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants