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

[Select] hide QueryList item list when menuContent and createItemView are both null #3426

Merged
merged 2 commits into from
Mar 22, 2019
Merged
Changes from 1 commit
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
3 changes: 3 additions & 0 deletions packages/select/src/components/query-list/queryList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,9 @@ export class QueryList<T> extends React.Component<IQueryListProps<T>, IQueryList
const maybeNoResults = this.isCreateItemRendered() ? null : noResults;
const menuContent = renderFilteredItems(listProps, maybeNoResults, initialContent);
const createItemView = this.isCreateItemRendered() ? this.renderCreateItemMenuItem(this.state.query) : null;
if (menuContent === null && createItemView === null) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I think you should check == null in both cases. we don't have strict null checks enabled in this project. maybeNoResults could be undefined at this point.

Copy link
Contributor

Choose a reason for hiding this comment

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

yes == is essential here. looks good otherwise.

return null;
}
return (
<Menu ulRef={listProps.itemsParentRef}>
{menuContent}
Expand Down