-
Notifications
You must be signed in to change notification settings - Fork 14.3k
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
[sqllab] fix data grid's instant search function #4717
Conversation
It looks like any non-string type would break the search feature. of `FilterableTable`
return metrics.width; | ||
if (context) { | ||
// Won't work outside of a browser context (ie unit tests) | ||
context.font = fontDetails; |
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.
nit: context = {...context, font: fontDetails}
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.
i don't think that works for objects with methods...
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.
I tested it in my console:
> test_obj = { my_func: () => 'test'}
{ my_func: [Function: my_func] }
> new_test_obj = {...test_obj}
{ my_func: [Function: my_func] }
> new_test_obj
{ my_func: [Function: my_func] }
> new_test_obj.my_func()
'test'
It seems like it works, but no biggie if you want to keep it as is. I'm not 💯% sure it won't break at runtime
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.
I meant prototype "inherited" funcs
// Won't work outside of a browser context (ie unit tests) | ||
context.font = fontDetails; | ||
const metrics = context.measureText(text); | ||
return metrics.width; |
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.
nit: just return context.measureText(text).width
🚢 |
31db249
to
8d01cd5
Compare
* [sqllab] fix data grid's instant search function It looks like any non-string type would break the search feature. of `FilterableTable` * Addressing comments
* [sqllab] fix data grid's instant search function It looks like any non-string type would break the search feature. of `FilterableTable` * Addressing comments
* [sqllab] fix data grid's instant search function It looks like any non-string type would break the search feature. of `FilterableTable` * Addressing comments
* [sqllab] fix data grid's instant search function It looks like any non-string type would break the search feature. of `FilterableTable` * Addressing comments
* [sqllab] fix data grid's instant search function It looks like any non-string type would break the search feature. of `FilterableTable` * Addressing comments
* [sqllab] fix data grid's instant search function It looks like any non-string type would break the search feature. of `FilterableTable` * Addressing comments
* [sqllab] fix data grid's instant search function It looks like any non-string type would break the search feature. of `FilterableTable` * Addressing comments
* [sqllab] fix data grid's instant search function It looks like any non-string type would break the search feature. of `FilterableTable` * Addressing comments
* [sqllab] fix data grid's instant search function It looks like any non-string type would break the search feature. of `FilterableTable` * Addressing comments
* [sqllab] fix data grid's instant search function It looks like any non-string type would break the search feature. of `FilterableTable` * Addressing comments
It looks like any non-string type would break the search feature.
of
FilterableTable
.closes #4713