-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
[WIP] - Improve performance #212173
base: main
Are you sure you want to change the base?
[WIP] - Improve performance #212173
Conversation
🤖 Jobs for this PR can be triggered through checkboxes. 🚧
ℹ️ To trigger the CI, please tick the checkbox below 👇
|
securityLayout: { getPluginWrapper }, | ||
}, | ||
} = useKibana(); | ||
export const PluginTemplateWrapper: FC<KibanaPageTemplateProps> = React.memo( |
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.
Prevent multiple re-renders of the UI
@@ -67,10 +66,10 @@ export const useSourcererDataView = ( | |||
if (selectedDataView == null || missingPatterns.length > 0) { | |||
// old way of fetching indices, legacy timeline | |||
setLegacyPatterns(selectedPatterns); | |||
} else { | |||
} else if (legacyPatterns.length > 0) { |
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.
A new []
was being created on every run of this hook, thereby updating state, thereby re-rendering every component where this hook is being called
@@ -37,7 +40,9 @@ export const UnifiedTimelineBody = (props: UnifiedTimelineBodyProps) => { | |||
leadingControlColumns, | |||
onUpdatePageIndex, | |||
} = props; | |||
|
|||
const dataView = useGetScopedSourcererDataView({ |
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.
removed withDataView
in favor of this call as it only happens in one place in the tree since the only other location it was used was the child component UnifiedTimeline
here
<HideShowContainer | ||
$isVisible={TimelineTabs.query === activeTimelineTab} | ||
data-test-subj={`timeline-tab-content-${TimelineTabs.query}`} | ||
<OnDemandRenderer |
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.
Only load the components when you click on the tab, but it remains rendered after first load
* every time timeline is closed and re-opened after the first interaction. | ||
*/ | ||
|
||
const getTimelineShowStatus = useMemo(() => getTimelineShowStatusByIdSelector(), []); |
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.
Not necessary anymore as the entire tabs are now being rendered on demand
const categoryBrowserFields = Object.values(browserFields[categoryId]?.fields ?? {}); | ||
if (categoryBrowserFields.length > 0) { | ||
fieldItemsAcc.push( |
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.
6f23250
to
f03d9db
Compare
/ci |
62d9a8b
to
cd514e9
Compare
/ci |
/ci |
💔 Build Failed
Failed CI StepsHistory
|
Summary
Summarize your PR. If it involves visual changes include a screenshot or gif.
Checklist
Check the PR satisfies following conditions.
Reviewers should verify this PR satisfies this list as well.
release_note:breaking
label should be applied in these situations.release_note:*
label is applied per the guidelinesIdentify risks
Does this PR introduce any risks? For example, consider risks like hard to test bugs, performance regression, potential of data loss.
Describe the risk, its severity, and mitigation for each identified risk. Invite stakeholders and evaluate how to proceed before merging.