-
Notifications
You must be signed in to change notification settings - Fork 13.8k
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: clean up codes #22002
refactor: clean up codes #22002
Conversation
import { getUrlParam } from 'src/utils/urlUtils'; | ||
import { URL_PARAMS } from 'src/constants'; | ||
import { isNullish } from 'src/utils/common'; |
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.
replace isNullish
with isDefined
@@ -121,7 +117,7 @@ const changeFilterValue = async () => { | |||
userEvent.click(screen.getAllByText('No filter')[0]); | |||
userEvent.click(screen.getByDisplayValue('Last day')); | |||
expect(await screen.findByText(/2021-04-13/)).toBeInTheDocument(); | |||
userEvent.click(screen.getByTestId(getDateControlTestId('apply-button'))); | |||
userEvent.click(screen.getByTestId(DATE_FILTER_TEST_KEY.applyButton)); |
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.
Keep simple logic for a simple use case.
setTooltipTitle( | ||
type === ('error' as Type) | ||
? t('Default value is required') | ||
: actualRange || '', | ||
); |
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 the default value always gets from Store
or constants
, the value of the DateFilterControl
will not be undefined.
So the type in the DateFilterControl
is useless.
@@ -302,7 +295,7 @@ export default function DateFilterLabel(props: DateFilterControlProps) { | |||
disabled={!validTimeRange} | |||
key="apply" | |||
onClick={onSave} | |||
{...getDateFilterControlTestId('apply-button')} | |||
data-test={DATE_FILTER_TEST_KEY.applyButton} |
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.
Keep simple too.
Codecov Report
@@ Coverage Diff @@
## master #22002 +/- ##
=======================================
Coverage 67.03% 67.03%
=======================================
Files 1813 1813
Lines 69437 69425 -12
Branches 7449 7447 -2
=======================================
- Hits 46545 46542 -3
+ Misses 20972 20963 -9
Partials 1920 1920
Flags with carried forward coverage won't be shown. Click here to find out more.
📣 We’re building smart automated test selection to slash your CI/CD build times. 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.
LGTM
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 work. LGTM
SUMMARY
This PR clears codes up. It's no logical change. I will add comments on the codes for the reviewer.
BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
TESTING INSTRUCTIONS
ADDITIONAL INFORMATION