Skip to content
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

[SearchBar] Improve rendering performance #119189

Merged
Merged
Show file tree
Hide file tree
Changes from 15 commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
4f0ee14
improve
Dosant Dec 6, 2021
588407c
remove unused imports
Dosant Dec 6, 2021
3b8e2bc
fix tests
Dosant Dec 7, 2021
3927791
Merge branch 'main' of github.com:elastic/kibana into d/2021-11-15-op…
Dosant Dec 7, 2021
447ae0d
fix query history
Dosant Dec 7, 2021
5508677
fix time history
Dosant Dec 7, 2021
4f8b47c
capture scroll event
Dosant Dec 7, 2021
c78f56e
fix tests
Dosant Dec 7, 2021
67aca4e
Merge branch 'main' into d/2021-11-15-optimize-search-bar-react-rende…
kibanamachine Dec 7, 2021
b677e64
Merge branch 'main' into d/2021-11-15-optimize-search-bar-react-rende…
kibanamachine Dec 9, 2021
588abba
Merge branch 'main' of github.com:elastic/kibana into d/2021-11-15-op…
Dosant Dec 13, 2021
02ff1d7
Merge branch 'd/2021-11-15-optimize-search-bar-react-rendering' of gi…
Dosant Dec 13, 2021
49a48f6
Merge branch 'main' into d/2021-11-15-optimize-search-bar-react-rende…
kibanamachine Dec 15, 2021
92712b4
Merge branch 'main' into d/2021-11-15-optimize-search-bar-react-rende…
kibanamachine Dec 17, 2021
a7d4964
improve shallow-equal copy
Dosant Dec 17, 2021
e5e04bc
Merge branch 'main' of github.com:elastic/kibana into d/2021-11-15-op…
Dosant Dec 20, 2021
632aa5b
Merge branch 'main' into d/2021-11-15-optimize-search-bar-react-rende…
kibanamachine Dec 23, 2021
13420aa
Merge branch 'main' into d/2021-11-15-optimize-search-bar-react-rende…
kibanamachine Dec 30, 2021
f109074
Merge branch 'main' into d/2021-11-15-optimize-search-bar-react-rende…
kibanamachine Jan 4, 2022
0e07ea6
Merge branch 'main' of github.com:elastic/kibana into d/2021-11-15-op…
Dosant Jan 5, 2022
72e05ef
remove redundant null checks
Dosant Jan 5, 2022
245aa56
Merge branch 'main' into d/2021-11-15-optimize-search-bar-react-rende…
kibanamachine Jan 5, 2022
1f4cdc2
Merge branch 'main' into d/2021-11-15-optimize-search-bar-react-rende…
kibanamachine Jan 6, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@
"markdown-it": "^10.0.0",
"md5": "^2.1.0",
"mdast-util-to-hast": "10.0.1",
"memoize-one": "^5.0.0",
"memoize-one": "^6.0.0",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updating because now it has clear() method

"mime": "^2.4.4",
"mime-types": "^2.1.27",
"mini-css-extract-plugin": "1.1.0",
Expand Down Expand Up @@ -585,7 +585,6 @@
"@types/lz-string": "^1.3.34",
"@types/markdown-it": "^0.0.7",
"@types/md5": "^2.2.0",
"@types/memoize-one": "^4.1.0",
"@types/mime": "^2.0.1",
"@types/mime-types": "^2.1.0",
"@types/minimatch": "^2.0.29",
Expand Down
4 changes: 4 additions & 0 deletions src/plugins/data/public/query/timefilter/time_history.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ export class TimeHistory {
get() {
return this.history.get();
}

get$() {
return this.history.get$();
}
}

export type TimeHistoryContract = PublicMethodsOf<TimeHistory>;
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import type { PublicMethodsOf } from '@kbn/utility-types';
import { TimefilterService, TimeHistoryContract, TimefilterContract } from '.';
import { Observable } from 'rxjs';
import { TimeRange } from '../../../common';

export type TimefilterServiceClientContract = PublicMethodsOf<TimefilterService>;

Expand Down Expand Up @@ -43,6 +44,7 @@ const createSetupContractMock = () => {
const historyMock: jest.Mocked<TimeHistoryContract> = {
add: jest.fn(),
get: jest.fn(),
get$: jest.fn(() => new Observable<TimeRange[]>()),
};

const setupContract = {
Expand Down
4 changes: 2 additions & 2 deletions src/plugins/data/public/ui/filter_bar/filter_bar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ interface Props {
timeRangeForSuggestionsOverride?: boolean;
}

function FilterBarUI(props: Props) {
const FilterBarUI = React.memo(function FilterBarUI(props: Props) {
const groupRef = useRef<HTMLDivElement>(null);
const [isAddFilterPopoverOpen, setIsAddFilterPopoverOpen] = useState(false);
const kibana = useKibana<IDataPluginServices>();
Expand Down Expand Up @@ -226,6 +226,6 @@ function FilterBarUI(props: Props) {
</EuiFlexItem>
</EuiFlexGroup>
);
}
});

export const FilterBar = injectI18n(FilterBarUI);
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export interface QueryLanguageSwitcherProps {
nonKqlModeHelpText?: string;
}

export function QueryLanguageSwitcher({
export const QueryLanguageSwitcher = React.memo(function QueryLanguageSwitcher({
language,
anchorPosition,
onSelectLanguage,
Expand Down Expand Up @@ -148,4 +148,4 @@ export function QueryLanguageSwitcher({
</div>
</EuiPopover>
);
}
});
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ import { mockPersistedLogFactory } from './query_string_input.test.mocks';
import React from 'react';
import { mount } from 'enzyme';
import { render } from '@testing-library/react';
import { EMPTY } from 'rxjs';

import QueryBarTopRow from './query_bar_top_row';

import { coreMock } from '../../../../../core/public/mocks';
import { dataPluginMock } from '../../mocks';
import { KibanaContextProvider } from 'src/plugins/kibana_react/public';
Expand All @@ -26,6 +26,7 @@ const mockTimeHistory = {
get: () => {
return [];
},
get$: () => EMPTY,
};

startMock.uiSettings.get.mockImplementation((key: string) => {
Expand Down
Loading