-
Notifications
You must be signed in to change notification settings - Fork 14.5k
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
fix: Add MAX_SQL_ROW value to LIMIT_DROPDOWN #12555
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -539,9 +539,13 @@ class SqlEditor extends React.PureComponent { | |
} | ||
|
||
renderQueryLimit() { | ||
const menuDropdown = ( | ||
// Adding SQL_MAX_ROW value to dropdown | ||
const { maxRow } = this.props; | ||
LIMIT_DROPDOWN.push(maxRow); | ||
|
||
return ( | ||
<AntdMenu> | ||
{LIMIT_DROPDOWN.map(limit => ( | ||
{[...new Set(LIMIT_DROPDOWN)].map(limit => ( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not familiar with There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Set does not order its contents, just makes sure they're unique, and adds them in the order they're added to the set. So this implementation should not affect the order of the contents of LIMIT_DROPDOWN. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks, @rusackas! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For the record, JavaScript sets are ordered: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set#iteration_methods Set iterators returns items in insertion order. |
||
<AntdMenu.Item onClick={() => this.setQueryLimit(limit)}> | ||
{/* // eslint-disable-line no-use-before-define */} | ||
<a role="button" styling="link"> | ||
|
@@ -551,8 +555,6 @@ class SqlEditor extends React.PureComponent { | |
))} | ||
</AntdMenu> | ||
); | ||
|
||
return menuDropdown; | ||
} | ||
|
||
renderEditorBottomBar() { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we add some tests and check if
maxRow
is undefined? Will it print "undefined" as an option?