[Logs Shared] Reduce load bundle size (#184925)

## 📓 Summary

I found a couple of heavy components which could be dynamically exported
and reduce the load bundle for the plugin by ~50kb.

Co-authored-by: Marco Antonio Ghiani <marcoantonio.ghiani@elastic.co>
This commit is contained in:
Marco Antonio Ghiani 2024-06-07 09:40:44 +02:00 committed by GitHub
parent e5ea1d43ce
commit bdb722ff20
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 10 additions and 3 deletions

View file

@ -209,6 +209,9 @@ export const LogEntryFlyout = ({
);
};
// eslint-disable-next-line import/no-default-export
export default LogEntryFlyout;
const loadingProgressMessage = i18n.translate('xpack.logsShared.logFlyout.loadingMessage', {
defaultMessage: 'Searching log entry in shards',
});

View file

@ -38,3 +38,6 @@ export const WithSummary = ({ serializedParsedQuery, children }: WithSummaryProp
return children({ buckets, start, end });
};
// eslint-disable-next-line import/no-default-export
export default WithSummary;

View file

@ -33,8 +33,6 @@ export {
useLogHighlightsStateContext,
} from './containers/logs/log_highlights';
export type { LogSummaryBuckets, WithSummaryProps } from './containers/logs/log_summary';
export { useLogSummary, WithSummary } from './containers/logs/log_summary';
export { useLogEntryFlyout } from './components/logging/log_entry_flyout';
// Shared components
export type { LogAIAssistantDocument } from './components/log_ai_assistant/log_ai_assistant';
@ -46,10 +44,13 @@ export {
iconColumnId,
useColumnWidths,
} from './components/logging/log_text_stream/log_entry_column';
export { LogEntryFlyout } from './components/logging/log_entry_flyout';
export type { LogAIAssistantProps } from './components/log_ai_assistant/log_ai_assistant';
export type { LogStreamProps } from './components/log_stream/log_stream';
export const WithSummary = dynamic(() => import('./containers/logs/log_summary/with_summary'));
export const LogEntryFlyout = dynamic(
() => import('./components/logging/log_entry_flyout/log_entry_flyout')
);
export const LogAIAssistant = dynamic(
() => import('./components/log_ai_assistant/log_ai_assistant')
);