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

[Discover] Switch from "at" to "charAt" for better browser support #156474

Merged
merged 2 commits into from
May 4, 2023

Conversation

jughosta
Copy link
Contributor

@jughosta jughosta commented May 3, 2023

From the community forum: users can't access Discover on older browsers.

TypeError: t.at is not a function
at http://xxx:5601/61109/bundles/plugin/data/kibana/data.plugin.js:1:312992
at Array.forEach ()
at n (http://xxx:5601/61109/bundles/plugin/data/kibana/data.plugin.js:1:312956)
at s (http://xxx:5601/61109/bundles/plugin/discover/kibana/discover.chunk.0.js:1:10138)
at http://xxx:5601/61109/bundles/plugin/discover/kibana/discover.chunk.0.js:1:10215
at Array.map ()
at a (http://xxx:5601/61109/bundles/plugin/discover/kibana/discover.chunk.0.js:1:10207)
at http://xxx:5601/61109/bundles/plugin/discover/kibana/discover.chunk.0.js:1:8442
at http://xxx:5601/61109/bundles/kbn-ui-shared-deps-npm/kbn-ui-shared-deps-npm.dll.js:334:27724
at t.s._next (http://xxx:5601/61109/bundles/kbn-ui-shared-deps-npm/kbn-ui-shared-deps-npm.dll.js:6:33456)

Summary

This PR replaces String .at usage with .charAt so it does not require a polyfill for older browsers.

@jughosta jughosta added Feature:Discover Discover Application release_note:fix Team:DataDiscovery Discover, search (e.g. data plugin and KQL), data views, saved searches. For ES|QL, use Team:ES|QL. v8.7.0 v8.8.0 v8.9.0 labels May 3, 2023
@jughosta jughosta self-assigned this May 3, 2023
@kibana-ci
Copy link
Collaborator

💚 Build Succeeded

Metrics [docs]

Page load bundle

Size of the bundles that are downloaded on every page load. Target size is below 100kb

id before after diff
data 404.1KB 404.1KB +4.0B
Unknown metric groups

ESLint disabled line counts

id before after diff
enterpriseSearch 19 21 +2
securitySolution 398 401 +3
total +5

Total ESLint disabled count

id before after diff
enterpriseSearch 20 22 +2
securitySolution 478 481 +3
total +5

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

cc @jughosta

@jughosta jughosta marked this pull request as ready for review May 3, 2023 11:27
@jughosta jughosta requested review from a team as code owners May 3, 2023 11:27
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-data-discovery (Team:DataDiscovery)

@kertal
Copy link
Member

kertal commented May 3, 2023

This is interesting, since the .at was introduced in #137147, so 8.5 was the version (users says it was upgraded from 8.6.1)

@@ -216,7 +217,7 @@ describe('tabify_docs', () => {
},
},
},
metaFields: ['_id', '_index', '_score', '_type', '_size'],
metaFields: ['_id', '_index', '_score', '_type', '_size', 'invalid_meta'],
Copy link
Member

Choose a reason for hiding this comment

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

I like this add-on , because now the test even makes more sense

Copy link
Member

@kertal kertal left a comment

Choose a reason for hiding this comment

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

LGTM 👍 Special thx for improving the unit test.

Copy link
Contributor

@stratoula stratoula left a comment

Choose a reason for hiding this comment

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

Changes LGTM, I mostly did a code review as I dont have an older version to test but the change makes sense to me 👍

@jughosta jughosta merged commit 396a2b6 into elastic:main May 4, 2023
@jughosta jughosta deleted the at-exception branch May 4, 2023 09:11
kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request May 4, 2023
…lastic#156474)

From the community forum: users can't access Discover on older browsers.

```
TypeError: t.at is not a function
at http://xxx:5601/61109/bundles/plugin/data/kibana/data.plugin.js:1:312992
at Array.forEach ()
at n (http://xxx:5601/61109/bundles/plugin/data/kibana/data.plugin.js:1:312956)
at s (http://xxx:5601/61109/bundles/plugin/discover/kibana/discover.chunk.0.js:1:10138)
at http://xxx:5601/61109/bundles/plugin/discover/kibana/discover.chunk.0.js:1:10215
at Array.map ()
at a (http://xxx:5601/61109/bundles/plugin/discover/kibana/discover.chunk.0.js:1:10207)
at http://xxx:5601/61109/bundles/plugin/discover/kibana/discover.chunk.0.js:1:8442
at http://xxx:5601/61109/bundles/kbn-ui-shared-deps-npm/kbn-ui-shared-deps-npm.dll.js:334:27724
at t.s._next (http://xxx:5601/61109/bundles/kbn-ui-shared-deps-npm/kbn-ui-shared-deps-npm.dll.js:6:33456)
```

- https://discuss.elastic.co/t/update-to-8-7-0/329525
-
https://discuss.elastic.co/t/elastic-8-7-0-error-in-discover-tab/332329/2

## Summary

This PR replaces `String` `.at` usage with `.charAt` so it does not
require a polyfill for older browsers.

(cherry picked from commit 396a2b6)
kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request May 4, 2023
…lastic#156474)

From the community forum: users can't access Discover on older browsers.

```
TypeError: t.at is not a function
at http://xxx:5601/61109/bundles/plugin/data/kibana/data.plugin.js:1:312992
at Array.forEach ()
at n (http://xxx:5601/61109/bundles/plugin/data/kibana/data.plugin.js:1:312956)
at s (http://xxx:5601/61109/bundles/plugin/discover/kibana/discover.chunk.0.js:1:10138)
at http://xxx:5601/61109/bundles/plugin/discover/kibana/discover.chunk.0.js:1:10215
at Array.map ()
at a (http://xxx:5601/61109/bundles/plugin/discover/kibana/discover.chunk.0.js:1:10207)
at http://xxx:5601/61109/bundles/plugin/discover/kibana/discover.chunk.0.js:1:8442
at http://xxx:5601/61109/bundles/kbn-ui-shared-deps-npm/kbn-ui-shared-deps-npm.dll.js:334:27724
at t.s._next (http://xxx:5601/61109/bundles/kbn-ui-shared-deps-npm/kbn-ui-shared-deps-npm.dll.js:6:33456)
```

- https://discuss.elastic.co/t/update-to-8-7-0/329525
-
https://discuss.elastic.co/t/elastic-8-7-0-error-in-discover-tab/332329/2

## Summary

This PR replaces `String` `.at` usage with `.charAt` so it does not
require a polyfill for older browsers.

(cherry picked from commit 396a2b6)
@kibanamachine
Copy link
Contributor

💚 All backports created successfully

Status Branch Result
8.7
8.8

Note: Successful backport PRs will be merged automatically after passing CI.

Questions ?

Please refer to the Backport tool documentation

kibanamachine added a commit that referenced this pull request May 4, 2023
…ort (#156474) (#156656)

# Backport

This will backport the following commits from `main` to `8.7`:
- [[Discover] Switch from "at" to "charAt" for better browser support
(#156474)](#156474)

<!--- Backport version: 8.9.7 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Julia
Rechkunova","email":"[email protected]"},"sourceCommit":{"committedDate":"2023-05-04T09:11:18Z","message":"[Discover]
Switch from \"at\" to \"charAt\" for better browser support
(#156474)\n\nFrom the community forum: users can't access Discover on
older browsers.\r\n\r\n```\r\nTypeError: t.at is not a function\r\nat
http://xxx:5601/61109/bundles/plugin/data/kibana/data.plugin.js:1:312992\r\nat
Array.forEach ()\r\nat n
(http://xxx:5601/61109/bundles/plugin/data/kibana/data.plugin.js:1:312956)\r\nat
s
(http://xxx:5601/61109/bundles/plugin/discover/kibana/discover.chunk.0.js:1:10138)\r\nat
http://xxx:5601/61109/bundles/plugin/discover/kibana/discover.chunk.0.js:1:10215\r\nat
Array.map ()\r\nat a
(http://xxx:5601/61109/bundles/plugin/discover/kibana/discover.chunk.0.js:1:10207)\r\nat
http://xxx:5601/61109/bundles/plugin/discover/kibana/discover.chunk.0.js:1:8442\r\nat
http://xxx:5601/61109/bundles/kbn-ui-shared-deps-npm/kbn-ui-shared-deps-npm.dll.js:334:27724\r\nat
t.s._next
(http://xxx:5601/61109/bundles/kbn-ui-shared-deps-npm/kbn-ui-shared-deps-npm.dll.js:6:33456)\r\n```\r\n\r\n-
https://discuss.elastic.co/t/update-to-8-7-0/329525\r\n-\r\nhttps://discuss.elastic.co/t/elastic-8-7-0-error-in-discover-tab/332329/2\r\n\r\n##
Summary\r\n\r\nThis PR replaces `String` `.at` usage with `.charAt` so
it does not\r\nrequire a polyfill for older
browsers.","sha":"396a2b63d461102cb312168adf9303265919c16c","branchLabelMapping":{"^v8.9.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["Feature:Discover","release_note:fix","Team:DataDiscovery","v8.7.0","v8.8.0","v8.9.0"],"number":156474,"url":"https://github.com/elastic/kibana/pull/156474","mergeCommit":{"message":"[Discover]
Switch from \"at\" to \"charAt\" for better browser support
(#156474)\n\nFrom the community forum: users can't access Discover on
older browsers.\r\n\r\n```\r\nTypeError: t.at is not a function\r\nat
http://xxx:5601/61109/bundles/plugin/data/kibana/data.plugin.js:1:312992\r\nat
Array.forEach ()\r\nat n
(http://xxx:5601/61109/bundles/plugin/data/kibana/data.plugin.js:1:312956)\r\nat
s
(http://xxx:5601/61109/bundles/plugin/discover/kibana/discover.chunk.0.js:1:10138)\r\nat
http://xxx:5601/61109/bundles/plugin/discover/kibana/discover.chunk.0.js:1:10215\r\nat
Array.map ()\r\nat a
(http://xxx:5601/61109/bundles/plugin/discover/kibana/discover.chunk.0.js:1:10207)\r\nat
http://xxx:5601/61109/bundles/plugin/discover/kibana/discover.chunk.0.js:1:8442\r\nat
http://xxx:5601/61109/bundles/kbn-ui-shared-deps-npm/kbn-ui-shared-deps-npm.dll.js:334:27724\r\nat
t.s._next
(http://xxx:5601/61109/bundles/kbn-ui-shared-deps-npm/kbn-ui-shared-deps-npm.dll.js:6:33456)\r\n```\r\n\r\n-
https://discuss.elastic.co/t/update-to-8-7-0/329525\r\n-\r\nhttps://discuss.elastic.co/t/elastic-8-7-0-error-in-discover-tab/332329/2\r\n\r\n##
Summary\r\n\r\nThis PR replaces `String` `.at` usage with `.charAt` so
it does not\r\nrequire a polyfill for older
browsers.","sha":"396a2b63d461102cb312168adf9303265919c16c"}},"sourceBranch":"main","suggestedTargetBranches":["8.7","8.8"],"targetPullRequestStates":[{"branch":"8.7","label":"v8.7.0","labelRegex":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.8","label":"v8.8.0","labelRegex":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v8.9.0","labelRegex":"^v8.9.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/156474","number":156474,"mergeCommit":{"message":"[Discover]
Switch from \"at\" to \"charAt\" for better browser support
(#156474)\n\nFrom the community forum: users can't access Discover on
older browsers.\r\n\r\n```\r\nTypeError: t.at is not a function\r\nat
http://xxx:5601/61109/bundles/plugin/data/kibana/data.plugin.js:1:312992\r\nat
Array.forEach ()\r\nat n
(http://xxx:5601/61109/bundles/plugin/data/kibana/data.plugin.js:1:312956)\r\nat
s
(http://xxx:5601/61109/bundles/plugin/discover/kibana/discover.chunk.0.js:1:10138)\r\nat
http://xxx:5601/61109/bundles/plugin/discover/kibana/discover.chunk.0.js:1:10215\r\nat
Array.map ()\r\nat a
(http://xxx:5601/61109/bundles/plugin/discover/kibana/discover.chunk.0.js:1:10207)\r\nat
http://xxx:5601/61109/bundles/plugin/discover/kibana/discover.chunk.0.js:1:8442\r\nat
http://xxx:5601/61109/bundles/kbn-ui-shared-deps-npm/kbn-ui-shared-deps-npm.dll.js:334:27724\r\nat
t.s._next
(http://xxx:5601/61109/bundles/kbn-ui-shared-deps-npm/kbn-ui-shared-deps-npm.dll.js:6:33456)\r\n```\r\n\r\n-
https://discuss.elastic.co/t/update-to-8-7-0/329525\r\n-\r\nhttps://discuss.elastic.co/t/elastic-8-7-0-error-in-discover-tab/332329/2\r\n\r\n##
Summary\r\n\r\nThis PR replaces `String` `.at` usage with `.charAt` so
it does not\r\nrequire a polyfill for older
browsers.","sha":"396a2b63d461102cb312168adf9303265919c16c"}}]}]
BACKPORT-->

Co-authored-by: Julia Rechkunova <[email protected]>
kibanamachine added a commit that referenced this pull request May 4, 2023
…ort (#156474) (#156657)

# Backport

This will backport the following commits from `main` to `8.8`:
- [[Discover] Switch from "at" to "charAt" for better browser support
(#156474)](#156474)

<!--- Backport version: 8.9.7 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Julia
Rechkunova","email":"[email protected]"},"sourceCommit":{"committedDate":"2023-05-04T09:11:18Z","message":"[Discover]
Switch from \"at\" to \"charAt\" for better browser support
(#156474)\n\nFrom the community forum: users can't access Discover on
older browsers.\r\n\r\n```\r\nTypeError: t.at is not a function\r\nat
http://xxx:5601/61109/bundles/plugin/data/kibana/data.plugin.js:1:312992\r\nat
Array.forEach ()\r\nat n
(http://xxx:5601/61109/bundles/plugin/data/kibana/data.plugin.js:1:312956)\r\nat
s
(http://xxx:5601/61109/bundles/plugin/discover/kibana/discover.chunk.0.js:1:10138)\r\nat
http://xxx:5601/61109/bundles/plugin/discover/kibana/discover.chunk.0.js:1:10215\r\nat
Array.map ()\r\nat a
(http://xxx:5601/61109/bundles/plugin/discover/kibana/discover.chunk.0.js:1:10207)\r\nat
http://xxx:5601/61109/bundles/plugin/discover/kibana/discover.chunk.0.js:1:8442\r\nat
http://xxx:5601/61109/bundles/kbn-ui-shared-deps-npm/kbn-ui-shared-deps-npm.dll.js:334:27724\r\nat
t.s._next
(http://xxx:5601/61109/bundles/kbn-ui-shared-deps-npm/kbn-ui-shared-deps-npm.dll.js:6:33456)\r\n```\r\n\r\n-
https://discuss.elastic.co/t/update-to-8-7-0/329525\r\n-\r\nhttps://discuss.elastic.co/t/elastic-8-7-0-error-in-discover-tab/332329/2\r\n\r\n##
Summary\r\n\r\nThis PR replaces `String` `.at` usage with `.charAt` so
it does not\r\nrequire a polyfill for older
browsers.","sha":"396a2b63d461102cb312168adf9303265919c16c","branchLabelMapping":{"^v8.9.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["Feature:Discover","release_note:fix","Team:DataDiscovery","v8.7.0","v8.8.0","v8.9.0"],"number":156474,"url":"https://github.com/elastic/kibana/pull/156474","mergeCommit":{"message":"[Discover]
Switch from \"at\" to \"charAt\" for better browser support
(#156474)\n\nFrom the community forum: users can't access Discover on
older browsers.\r\n\r\n```\r\nTypeError: t.at is not a function\r\nat
http://xxx:5601/61109/bundles/plugin/data/kibana/data.plugin.js:1:312992\r\nat
Array.forEach ()\r\nat n
(http://xxx:5601/61109/bundles/plugin/data/kibana/data.plugin.js:1:312956)\r\nat
s
(http://xxx:5601/61109/bundles/plugin/discover/kibana/discover.chunk.0.js:1:10138)\r\nat
http://xxx:5601/61109/bundles/plugin/discover/kibana/discover.chunk.0.js:1:10215\r\nat
Array.map ()\r\nat a
(http://xxx:5601/61109/bundles/plugin/discover/kibana/discover.chunk.0.js:1:10207)\r\nat
http://xxx:5601/61109/bundles/plugin/discover/kibana/discover.chunk.0.js:1:8442\r\nat
http://xxx:5601/61109/bundles/kbn-ui-shared-deps-npm/kbn-ui-shared-deps-npm.dll.js:334:27724\r\nat
t.s._next
(http://xxx:5601/61109/bundles/kbn-ui-shared-deps-npm/kbn-ui-shared-deps-npm.dll.js:6:33456)\r\n```\r\n\r\n-
https://discuss.elastic.co/t/update-to-8-7-0/329525\r\n-\r\nhttps://discuss.elastic.co/t/elastic-8-7-0-error-in-discover-tab/332329/2\r\n\r\n##
Summary\r\n\r\nThis PR replaces `String` `.at` usage with `.charAt` so
it does not\r\nrequire a polyfill for older
browsers.","sha":"396a2b63d461102cb312168adf9303265919c16c"}},"sourceBranch":"main","suggestedTargetBranches":["8.7","8.8"],"targetPullRequestStates":[{"branch":"8.7","label":"v8.7.0","labelRegex":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.8","label":"v8.8.0","labelRegex":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v8.9.0","labelRegex":"^v8.9.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/156474","number":156474,"mergeCommit":{"message":"[Discover]
Switch from \"at\" to \"charAt\" for better browser support
(#156474)\n\nFrom the community forum: users can't access Discover on
older browsers.\r\n\r\n```\r\nTypeError: t.at is not a function\r\nat
http://xxx:5601/61109/bundles/plugin/data/kibana/data.plugin.js:1:312992\r\nat
Array.forEach ()\r\nat n
(http://xxx:5601/61109/bundles/plugin/data/kibana/data.plugin.js:1:312956)\r\nat
s
(http://xxx:5601/61109/bundles/plugin/discover/kibana/discover.chunk.0.js:1:10138)\r\nat
http://xxx:5601/61109/bundles/plugin/discover/kibana/discover.chunk.0.js:1:10215\r\nat
Array.map ()\r\nat a
(http://xxx:5601/61109/bundles/plugin/discover/kibana/discover.chunk.0.js:1:10207)\r\nat
http://xxx:5601/61109/bundles/plugin/discover/kibana/discover.chunk.0.js:1:8442\r\nat
http://xxx:5601/61109/bundles/kbn-ui-shared-deps-npm/kbn-ui-shared-deps-npm.dll.js:334:27724\r\nat
t.s._next
(http://xxx:5601/61109/bundles/kbn-ui-shared-deps-npm/kbn-ui-shared-deps-npm.dll.js:6:33456)\r\n```\r\n\r\n-
https://discuss.elastic.co/t/update-to-8-7-0/329525\r\n-\r\nhttps://discuss.elastic.co/t/elastic-8-7-0-error-in-discover-tab/332329/2\r\n\r\n##
Summary\r\n\r\nThis PR replaces `String` `.at` usage with `.charAt` so
it does not\r\nrequire a polyfill for older
browsers.","sha":"396a2b63d461102cb312168adf9303265919c16c"}}]}]
BACKPORT-->

Co-authored-by: Julia Rechkunova <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature:Discover Discover Application release_note:fix Team:DataDiscovery Discover, search (e.g. data plugin and KQL), data views, saved searches. For ES|QL, use Team:ES|QL. v8.7.0 v8.7.2 v8.8.0 v8.9.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants