-
Notifications
You must be signed in to change notification settings - Fork 14.4k
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
chore: refactor ChartHolder to typescript + tests #20910
chore: refactor ChartHolder to typescript + tests #20910
Conversation
Codecov Report
@@ Coverage Diff @@
## master #20910 +/- ##
==========================================
+ Coverage 66.29% 66.34% +0.05%
==========================================
Files 1773 1774 +1
Lines 67680 67686 +6
Branches 7214 7215 +1
==========================================
+ Hits 44866 44907 +41
+ Misses 20971 20946 -25
+ Partials 1843 1833 -10
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 |
/testenv up |
🏷️ Preset-Patch |
@yousoph Ephemeral environment spinning up at http://54.202.171.173:8080. Credentials are |
); | ||
|
||
const infoFromPath = useMemo( | ||
() => getChartAndLabelComponentIdFromPath(directPathToChild) as any, |
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.
Is it possible to not use any
here?
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 could, but we'd need to change the file that contains that function to typescript, and there's a couple of types around the filters that are not well defined.
Plus, changing that file should follow with tests as well, and I didn't want to make this PR bigger, since it can be addressed as a follow up
const [currentDirectPathLastUpdated, setCurrentDirectPathLastUpdated] = | ||
useState(0); | ||
|
||
const directPathToChild = useMemo( |
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 might be mistaken, but since we are not computing an expensive function, just accessing a property inside the dashboardState
object, could we get rid of useMemo
? Or there is some performance implication if we remove it, that I'm not seeing. Same with directPathLastUpdated
below.
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.
These two are used in other hooks/callbacks below, so need to memoize those to avoid recomputing everything (even if it's just a string/etc)
@diegomedina248 Thank you for this PR! I have a SqlEditor refactoring into FC, can I share the code with you? |
@EugeneTorap sure thing! |
/testenv up |
@jinghua-qa Ephemeral environment spinning up at http://54.214.218.74:8080. Credentials are |
1 similar comment
@jinghua-qa Ephemeral environment spinning up at http://54.214.218.74:8080. Credentials are |
efe387e
to
d63f0de
Compare
/testenv up |
@jinghua-qa Ephemeral environment spinning up at http://34.221.79.198:8080. Credentials are |
Test again in the new ephemeral env and verified the reported issue is fixed. Regression test for dashboard LGTM |
@michael-s-molina @kgabryje @geido Can you review the PR and then merge 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.
LGTM!
@diegomedina248 A suggestion/tip for future refactors like this one - if you use git mv
to change filename, git diff will recognise the file as modified instead of 1 file deleted and 1 file created (like ChartHolder.jsx
-> ChartHolder.tsx
), which makes reviewing easier
Ephemeral environment shutdown and build artifacts deleted. |
SUMMARY
This PR refactors the ChartHolder into a functional component with typescript.
It also adds more test coverage.
BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
--
TESTING INSTRUCTIONS
--
ADDITIONAL INFORMATION