Skip to content
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

Feat: Use url params to store state in Checks list page #797

Merged
merged 23 commits into from
Jun 4, 2024

Conversation

VikaCep
Copy link
Contributor

@VikaCep VikaCep commented May 28, 2024

This PR implements applying list filters (such as search term, status, labels, probes), sorting selection and view type using the url query parameters instead of local storage. This brings a number of benefits such as being able to share the page maintaining the filters selection, being able to use the back/forth buttons, and also preventing unwanted behavior in certain scenarios.

Fixes #762

2024-05-31 19 06 37

2024-05-31 19 09 17

@VikaCep VikaCep self-assigned this May 28, 2024
@VikaCep VikaCep force-pushed the checks-page-using-url-params branch from 75befd6 to 193750d Compare May 28, 2024 00:38
@VikaCep VikaCep marked this pull request as ready for review May 28, 2024 00:48
@VikaCep VikaCep requested a review from a team as a code owner May 28, 2024 00:48
Copy link
Contributor

@ckbedwell ckbedwell left a comment

Choose a reason for hiding this comment

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

I am super excited that this works and you got it up so quickly!

Just some feedback to address to make this as durable as we can and make it something that endures and is re-usable in the long-term.

If you want some reference material, this is how it's been added in the k6-app. By no means have to use it, just something to consider 😄

src/components/CheckList/CheckList.test.tsx Outdated Show resolved Hide resolved
src/components/CheckList/CheckList.tsx Outdated Show resolved Hide resolved
src/components/CheckList/CheckList.tsx Outdated Show resolved Hide resolved
src/components/CheckList/CheckList.tsx Outdated Show resolved Hide resolved
src/hooks/useQueryParametersState.ts Outdated Show resolved Hide resolved
expect(historyPushMock).toHaveBeenCalledTimes(2);
expect(historyPushMock).toHaveBeenLastCalledWith({ search: `anotherKey=${encodeURIComponent('"anotherValue"')}` });
});
});
Copy link
Contributor

@ckbedwell ckbedwell May 29, 2024

Choose a reason for hiding this comment

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

I'm interested in if these unit tests endure after addressing the feedback. If they all break I'm not that bothered if you don't want to replace them. 😅

I love tests but I am less fussed about unit tests that are testing implementation details and more interested in testing user journeys and user-facing problems rather than developer centric ones. Some unit tests are great and totally necessary in FE but as we have the user-facing tests you've added for the checks list page (which will mostly endure through implementation detail changes) these matter less.

We can talk about this more later if you want 😄

src/components/CheckList/CheckList.tsx Outdated Show resolved Hide resolved
VikaCep added 13 commits May 29, 2024 16:39
- support to either push/replace on history
- remove usage of useEffect for setting a parameter which fixes back/forth buttons
- still pending to implement a better parsing strategy instead of using JSON.parse
There's still pending work on the "filters" param:
This is to prevent having a huge object with the "filters" key
Now we have a key for each filter separately, like labels=,type=,status=, etc.
- Probes encode/decode functions still need a refactor
- The idea is it doesn't rely on JSON.stringify/parse
@VikaCep VikaCep requested a review from ckbedwell May 31, 2024 22:10
ckbedwell
ckbedwell previously approved these changes Jun 4, 2024
Copy link
Contributor

@ckbedwell ckbedwell left a comment

Choose a reason for hiding this comment

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

Great work! Pure 🔥🔥🔥🔥🔥🔥🔥

I'm approving even though I've left two minor comments, feel free to merge after you've either addressed or dismissed them= 😄

src/components/CheckList/CheckList.tsx Outdated Show resolved Hide resolved
src/hooks/useQueryParametersState.ts Outdated Show resolved Hide resolved
@VikaCep VikaCep requested a review from ckbedwell June 4, 2024 13:49
Copy link
Contributor

@ckbedwell ckbedwell left a comment

Choose a reason for hiding this comment

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

🔥🔥🔥🔥🔥🔥

@VikaCep VikaCep merged commit e4455dc into main Jun 4, 2024
5 checks passed
@VikaCep VikaCep deleted the checks-page-using-url-params branch June 4, 2024 14:06
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.

Convert checks page to utilize URL parameters
2 participants