mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 01:38:56 -04:00
Enhance Event Fields Browser performance (#129861)
* Enhance Event Fields Browser performance * fixes checks * Update x-pack/plugins/security_solution/public/common/components/event_details/event_fields_browser.tsx Use idiomatic value for EUI's `itemId` field Co-authored-by: Jan Monschke <janmonschke@fastmail.com> Co-authored-by: Gloria Hornero <gloria.hornero@elastic.co> Co-authored-by: Jan Monschke <janmonschke@fastmail.com>
This commit is contained in:
parent
dcbf9daa00
commit
47b62d83af
2 changed files with 13 additions and 2 deletions
|
@ -279,6 +279,7 @@ export const EventFieldsBrowser = React.memo<Props>(
|
|||
<StyledEuiInMemoryTable
|
||||
className={EVENT_FIELDS_TABLE_CLASS_NAME}
|
||||
items={items}
|
||||
itemId="field"
|
||||
columns={columns}
|
||||
pagination={false}
|
||||
rowProps={onSetRowProps}
|
||||
|
|
|
@ -21,19 +21,27 @@ import type { TimelinesUIStart, TGridProps, TimelinesStartPlugins } from './type
|
|||
import { tGridReducer } from './store/t_grid/reducer';
|
||||
import { useDraggableKeyboardWrapper } from './components/drag_and_drop/draggable_keyboard_wrapper_hook';
|
||||
import { useAddToTimeline, useAddToTimelineSensor } from './hooks/use_add_to_timeline';
|
||||
import { getHoverActions } from './components/hover_actions';
|
||||
import { getHoverActions, HoverActionsConfig } from './components/hover_actions';
|
||||
|
||||
export class TimelinesPlugin implements Plugin<void, TimelinesUIStart> {
|
||||
private _store: Store | undefined;
|
||||
private _storage = new Storage(localStorage);
|
||||
private _storeUnsubscribe: Unsubscribe | undefined;
|
||||
|
||||
private _hoverActions: HoverActionsConfig | undefined;
|
||||
|
||||
public setup(core: CoreSetup) {}
|
||||
|
||||
public start(core: CoreStart, { data }: TimelinesStartPlugins): TimelinesUIStart {
|
||||
return {
|
||||
/** `getHoverActions` returns a new reference to `getAddToTimelineButton` each time it is called, but that value is used in dependency arrays and so it should be as stable as possible. Therefore we lazily store the reference to it. Note: this reference is deleted when the store is changed. */
|
||||
getHoverActions: () => {
|
||||
return getHoverActions(this._store);
|
||||
if (this._hoverActions) {
|
||||
return this._hoverActions;
|
||||
} else {
|
||||
this._hoverActions = getHoverActions(this._store);
|
||||
return this._hoverActions;
|
||||
}
|
||||
},
|
||||
getTGrid: (props: TGridProps) => {
|
||||
if (props.type === 'standalone' && this._store) {
|
||||
|
@ -89,6 +97,8 @@ export class TimelinesPlugin implements Plugin<void, TimelinesUIStart> {
|
|||
|
||||
private setStore(store: Store) {
|
||||
this._store = store;
|
||||
// this is lazily calculated and that is dependent on the store
|
||||
delete this._hoverActions;
|
||||
}
|
||||
|
||||
public stop() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue