-
Notifications
You must be signed in to change notification settings - Fork 13.9k
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 dashboard header to func component #31029
chore: Refactor dashboard header to func component #31029
Conversation
dashboardInfo.common?.conf?.DASHBOARD_AUTO_REFRESH_MODE === 'fetch' | ||
) { | ||
// force-refresh while auto-refresh in dashboard | ||
return boundActionCreators.fetchCharts( |
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: I know it was like this before this PR, but we could DRY it with a helper function so you can pass the boolean as arg and return the fetchCharts
call with it here and the one below
t( | ||
'Your dashboard is too large. Please reduce its size before saving it.', | ||
), | ||
); | ||
} else { | ||
if (positionJSONLength >= limit * 0.9) { | ||
this.props.addWarningToast('Your dashboard is near the size limit.'); | ||
boundActionCreators.addWarningToast( | ||
'Your dashboard is near the size limit.', |
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.
Should we translate this?
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 catch!
|
||
if (interval) { | ||
const periodicRefreshOptions = | ||
dashboardInfo.common?.conf?.DASHBOARD_AUTO_REFRESH_INTERVALS; |
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: Is this value dynamically changing somewhere or just a static config loaded once? If static, we could move this out the callback.
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 doesn't change, but technically it could since it's a part of the redux state object, so it should be included in the dependency array - it won't hurt and it won't trigger a lint warning
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
Maybe it would be nice to use |
good point 🤦 will keep that in mind next time |
SUMMARY
Refactor the dashboard Header component from class to function component. No functional changes, just a refactor
BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
TESTING INSTRUCTIONS
Everything should work like before
ADDITIONAL INFORMATION