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

[SQL Lab] Fix TableSelector perf for large option sets #7868

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,6 @@ describe('TableSelector', () => {
it('should clear table options', () => {
inst.fetchTables(true);
expect(wrapper.state().tableOptions).toEqual([]);
expect(wrapper.state().filterOptions).toBeNull();
});

it('should fetch table options', () => {
Expand Down
7 changes: 2 additions & 5 deletions superset/assets/src/components/TableSelector.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
import React from 'react';
import PropTypes from 'prop-types';
import Select from 'react-virtualized-select';
import createFilterOptions from 'react-select-fast-filter-options';
import { ControlLabel, Label } from 'react-bootstrap';
import { t } from '@superset-ui/translation';
import { SupersetClient } from '@superset-ui/connection';
Expand Down Expand Up @@ -70,7 +69,6 @@ export default class TableSelector extends React.PureComponent {
dbId: props.dbId,
schema: props.schema,
tableName: props.tableName,
filterOptions: null,
};
this.changeSchema = this.changeSchema.bind(this);
this.changeTable = this.changeTable.bind(this);
Expand Down Expand Up @@ -144,7 +142,6 @@ export default class TableSelector extends React.PureComponent {
title: o.title,
}));
this.setState(() => ({
filterOptions: createFilterOptions({ options }),
tableLoading: false,
tableOptions: options,
}));
Expand All @@ -155,7 +152,7 @@ export default class TableSelector extends React.PureComponent {
this.props.handleError(t('Error while fetching table list'));
});
}
this.setState(() => ({ tableLoading: false, tableOptions: [], filterOptions: null }));
this.setState(() => ({ tableLoading: false, tableOptions: [] }));
return Promise.resolve();
}
fetchSchemas(dbId, force) {
Expand Down Expand Up @@ -277,10 +274,10 @@ export default class TableSelector extends React.PureComponent {
name="select-table"
ref="selectTable"
isLoading={this.state.tableLoading}
ignoreAccents={false}
placeholder={t('Select table or type table name')}
autosize={false}
onChange={this.changeTable}
filterOptions={this.state.filterOptions}

Choose a reason for hiding this comment

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

there is a unit test for filterOptions prop. are you sure to remove it?

Copy link
Member Author

Choose a reason for hiding this comment

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

oops, fixed!

options={options}
value={this.state.tableName}
/>) : (
Expand Down