Skip to content

Commit

Permalink
remove unused handleListUpdate
Browse files Browse the repository at this point in the history
Signed-off-by: Joshua Li <[email protected]>
  • Loading branch information
joshuali925 committed Jun 24, 2024
1 parent fc5369e commit 5b3e358
Showing 1 changed file with 0 additions and 20 deletions.
20 changes: 0 additions & 20 deletions src/plugins/data/public/ui/query_editor/query_editor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ interface State {
index: number | null;
suggestions: QuerySuggestion[];
indexPatterns: IIndexPattern[];
queryEditorRect: DOMRect | undefined;
}

const KEY_CODES = {
Expand All @@ -83,16 +82,13 @@ export default class QueryEditorUI extends Component<Props, State> {
index: null,
suggestions: [],
indexPatterns: [],
queryEditorRect: undefined,
};

public inputRef: HTMLTextAreaElement | null = null;

private persistedLog: PersistedLog | undefined;
private abortController?: AbortController;
private services = this.props.opensearchDashboards.services;
private componentIsUnmounting = false;
private queryEditorDivRefInstance: RefObject<HTMLDivElement> = createRef();
private headerRef: RefObject<HTMLDivElement> = createRef();
private bannerRef: RefObject<HTMLDivElement> = createRef();
private extensionMap = this.props.settings?.getQueryEditorExtensionMap();
Expand Down Expand Up @@ -238,12 +234,6 @@ export default class QueryEditorUI extends Component<Props, State> {

this.initPersistedLog();
// this.fetchIndexPatterns().then(this.updateSuggestions);
this.handleListUpdate();

window.addEventListener('scroll', this.handleListUpdate, {
passive: true, // for better performance as we won't call preventDefault
capture: true, // scroll events don't bubble, they must be captured instead
});
}

public componentDidUpdate(prevProps: Props) {
Expand All @@ -257,18 +247,8 @@ export default class QueryEditorUI extends Component<Props, State> {

public componentWillUnmount() {
if (this.abortController) this.abortController.abort();
this.componentIsUnmounting = true;
window.removeEventListener('scroll', this.handleListUpdate, { capture: true });
}

handleListUpdate = () => {
if (this.componentIsUnmounting) return;

return this.setState({
queryEditorRect: this.queryEditorDivRefInstance.current?.getBoundingClientRect(),
});
};

handleOnFocus = () => {
if (this.props.onChangeQueryEditorFocus) {
this.props.onChangeQueryEditorFocus(true);
Expand Down

0 comments on commit 5b3e358

Please sign in to comment.