-
Notifications
You must be signed in to change notification settings - Fork 25
Conversation
Passing run #13734 ↗︎
Details:
Review all test suite changes for PR #2092 ↗︎ |
I'd like to discuss this feature in the design sync before making more changes. |
I'll close this PR for now and reopen when it's ready for review |
This feature is similar to the "Include commit queue" |
> button { | ||
margin-left: ${size.xs}; | ||
} |
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.
Since this is already using flexbox, you can use the gap
property instead
> button { | |
margin-left: ${size.xs}; | |
} | |
gap: ${size.xs}; |
src/components/PatchesPage/index.tsx
Outdated
const StyledCheckbox = styled(Checkbox)` | ||
padding-left: ${size.xs}; | ||
`; |
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.
Similar note as above, you can add a gap
to CheckboxContainer
instead of creating a specialized checkbox.
e: React.ChangeEvent<HTMLInputElement> | ||
): void => { | ||
setIsIncludeHiddenCheckboxChecked(e.target.checked); | ||
Cookies.set(INCLUDE_HIDDEN_PATCHES, e.target.checked ? "true" : "false"); |
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.
When I load this page with this cookie set to true, the checkbox is checked but hidden patches are not visible in the list (i.e. the state is set but the query does not include the hidden parameter).
Tbh I don't know how helpful a cookie is for this setting. Unlike the commit queue, it's probably something that would be looked at in special circumstances, not every time a user visits this page. But if you think it's worth including then the bug should be fixed!
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.
I was able to fix the issue with initial state. I decided to include the cookie to keep consistency with the commit queue checkbox and pagination buttons and also because it's more likely to be helpful than annoying/intrusive
src/components/PatchesPage/index.tsx
Outdated
): void => { | ||
setIsIncludeHiddenCheckboxChecked(e.target.checked); | ||
Cookies.set(INCLUDE_HIDDEN_PATCHES, e.target.checked ? "true" : "false"); | ||
// eslint-disable-next-line no-unused-expressions |
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.
I see this is also disabled above but I'm confused as to why. Can we get rid of it?
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.
It's not necessary and I accidentally copied it in.
src/components/PatchesPage/index.tsx
Outdated
@@ -136,12 +160,14 @@ export const usePatchesInputFromSearch = (search: string): PatchesInput => { | |||
PatchPageQueryParams.Statuses, | |||
[] | |||
); | |||
const [hidden] = useQueryParam(PatchPageQueryParams.Hidden, false); |
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.
src/constants/cookies.ts
Outdated
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.
Thanks for sorting!
@@ -7,6 +7,7 @@ type Action = | |||
| { name: "Click Patch Link" } | |||
| { name: "Click Variant Icon"; variantIconStatus: string } | |||
| { name: "Filter Commit Queue" } | |||
| { name: "Filter Hidden" } |
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.
Can we update this analytics event to include what he hidden state is? So that it becomes a little more useful.
const { sendEvent } = usePatchAnalytics(patchId); | ||
const [setPatchVisibility] = useMutation< | ||
SetPatchVisibilityMutation, | ||
SetPatchVisibilityMutationVariables | ||
>(SET_PATCH_VISIBILITY, { | ||
onCompleted: () => { | ||
dispatchToast.success("This patch was successfully hidden"); | ||
dispatchToast.success("Successfully updated patch visibility."); |
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.
I'm actually not a fan of this verbiage, It isn't as clear as the old one. If you update the SET_PATCH_VISIBILITY
mutation to also return the hidden
state then you should be able to conditionally render a more tailored success message.
onCompleted: (d) => { | ||
dispatchToast.success( | ||
`This patch was successfully ${ | ||
d.setPatchVisibility?.[0].hidden ? "unhidden" : "hidden" |
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.
nit. Can you destructure this instead of deeply nesting?
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.
setPatchVisibility
is used in the outer scope so it can't be destructured in the onCompleted function argument.
The alternative is to do something like this:
const { hidden } = d.setPatchVisibility?.[0] ?? {};
I think this is a lot more busy than what I have originally considering there is an extra assignment and ternary for a variable that's only used once. Instead I can move the copy calculation out of the string literal.
> button { | ||
margin-left: ${size.xs}; | ||
} | ||
gap: ${size.xs}; |
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.
Nice
const [hidden] = useQueryParam(PatchPageQueryParams.Hidden, false); | ||
const statuses = rawStatuses.filter((v) => v && v !== ALL_PATCH_STATUS); | ||
return { | ||
limit: getLimitFromSearch(search), |
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.
Since you refactored this hook. Can we just use the useQueryParam
hook for everything instead of relying on these older getLimitFromSearch
and getPageFromSearch
functions. I would like to eventually get rid of them in favor of the hooks.
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.
I think this should be done in a separate ticket because it's not a straightforward refactor and I think the two functions serve their purpose. getLimitFromSearch
and getPageFromSearch
have reuseable logic that validate and map the query param to a valid value. If these two functions are removed, useQueryParam
should accept a validation function that determines whether the default value is returned. Otherwise, it may be worth to create a usePagination
hook that includes logic from usePageSizeSelector
and calls into useQueryParam
since page
and limit
are reserved for the pagination feature and used in a bunch of places.
@@ -128,10 +130,12 @@ export const PatchCard: React.FC<Props> = ({ | |||
<TaskBadgeContainer>{badges}</TaskBadgeContainer> | |||
</Center> | |||
<Right> | |||
{hidden && <Badge data-cy="hidden-badge">Hidden</Badge>} |
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.
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.
We discussed the Hidden
badge at the design sync but not the placement. I prefer the badge instead of opacity because opacity gives the patch card a filter effect and makes it more difficult to read. This is against the users intention to show hidden items.
I aligned Hidden badge next to the menu items because that's where the state is updated.
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.
nit. Can we move this into the PatchCard folder.
evergreen retry |
evergreen retry |
EVG-19921
hidden.mov
Evergreen PR
evergreen-ci/evergreen#7116