-
Notifications
You must be signed in to change notification settings - Fork 8.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
fix tty and related tests #206919
fix tty and related tests #206919
Conversation
/ci |
@elasticmachine merge upstream |
Pinging @elastic/appex-sharedux (Team:SharedUX) |
💚 Build Succeeded
Metrics [docs]Async chunks
History
cc @eokoneyo |
@elasticmachine merge upstream |
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.
LGTM - thanks for the changes
Starting backport for target branches: 8.x https://github.com/elastic/kibana/actions/runs/12870000277 |
## Summary Culled from elastic#206411 This PR is informed from the work that's being done for the migration to React 18, whilst trying out kibana with react 18 we had couple of test fail relating to this particular component, details here [[job]](https://buildkite.com/elastic/kibana-pull-request/builds/266993#0194655f-1466-4ee3-80ed-54e398b09492) [[logs]](https://buildkite.com/organizations/elastic/pipelines/kibana-pull-request/builds/266993/jobs/0194655f-1466-4ee3-80ed-54e398b09492/artifacts/01946583-34ed-444a-bc55-10e684c325ef), it's worth mentioning the way the component was written causes unnecessary re-renders that doesn't actually make the interval for the tty playspeed exactly constant. The approach taken here is such that there's no need to depend on state change to cause the next line to be written, now we setup a timer interval just once for the entire duration that the tty is playing, and said timer only ever gets cleaned up on pause. P.S. This fix does not utilize any APIs from react 18 so it's backward compatible with our current version of react. ### Checklist <!-- Check the PR satisfies following conditions. Reviewers should verify this PR satisfies this list as well. - [ ] Any text added follows [EUI's writing guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses sentence case text and includes [i18n support](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-i18n/README.md) - [ ] [Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html) was added for features that require explanation or tutorials --> - [x] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios <!-- - [ ] If a plugin configuration key changed, check if it needs to be allowlisted in the cloud and added to the [docker list](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker) - [ ] This was checked for breaking HTTP API changes, and any breaking changes have been approved by the breaking-change committee. The `release_note:breaking` label should be applied in these situations. - [ ] [Flaky Test Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was used on any tests changed - [ ] The PR description includes the appropriate Release Notes section, and the correct `release_note:*` label is applied per the [guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process) ### Identify risks Does this PR introduce any risks? For example, consider risks like hard to test bugs, performance regression, potential of data loss. Describe the risk, its severity, and mitigation for each identified risk. Invite stakeholders and evaluate how to proceed before merging. - [ ] [See some risk examples](https://github.com/elastic/kibana/blob/main/RISK_MATRIX.mdx) - [ ] ... --> Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com> (cherry picked from commit e7b5f3d)
💚 All backports created successfully
Note: Successful backport PRs will be merged automatically after passing CI. Questions ?Please refer to the Backport tool documentation |
# Backport This will backport the following commits from `main` to `8.x`: - [fix tty and related tests (#206919)](#206919) <!--- Backport version: 9.4.3 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) <!--BACKPORT [{"author":{"name":"Eyo O. Eyo","email":"7893459+eokoneyo@users.noreply.github.com"},"sourceCommit":{"committedDate":"2025-01-20T14:20:14Z","message":"fix tty and related tests (#206919)\n\n## Summary\r\n\r\nCulled from https://github.com/elastic/kibana/pull/206411\r\n\r\nThis PR is informed from the work that's being done for the migration to\r\nReact 18, whilst trying out kibana with react 18 we had couple of test\r\nfail relating to this particular component, details here\r\n[[job]](https://buildkite.com/elastic/kibana-pull-request/builds/266993#0194655f-1466-4ee3-80ed-54e398b09492)\r\n[[logs]](https://buildkite.com/organizations/elastic/pipelines/kibana-pull-request/builds/266993/jobs/0194655f-1466-4ee3-80ed-54e398b09492/artifacts/01946583-34ed-444a-bc55-10e684c325ef),\r\nit's worth mentioning the way the component was written causes\r\nunnecessary re-renders that doesn't actually make the interval for the\r\ntty playspeed exactly constant. The approach taken here is such that\r\nthere's no need to depend on state change to cause the next line to be\r\nwritten, now we setup a timer interval just once for the entire duration\r\nthat the tty is playing, and said timer only ever gets cleaned up on\r\npause.\r\n\r\n\r\nP.S. This fix does not utilize any APIs from react 18 so it's backward\r\ncompatible with our current version of react.\r\n\r\n### Checklist\r\n\r\n<!-- Check the PR satisfies following conditions. \r\n\r\nReviewers should verify this PR satisfies this list as well.\r\n\r\n- [ ] Any text added follows [EUI's writing\r\nguidelines](https://elastic.github.io/eui/#/guidelines/writing), uses\r\nsentence case text and includes [i18n\r\nsupport](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-i18n/README.md)\r\n- [ ]\r\n[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)\r\nwas added for features that require explanation or tutorials -->\r\n- [x] [Unit or functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere updated or added to match the most common scenarios\r\n<!--\r\n- [ ] If a plugin configuration key changed, check if it needs to be\r\nallowlisted in the cloud and added to the [docker\r\nlist](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)\r\n- [ ] This was checked for breaking HTTP API changes, and any breaking\r\nchanges have been approved by the breaking-change committee. The\r\n`release_note:breaking` label should be applied in these situations.\r\n- [ ] [Flaky Test\r\nRunner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was\r\nused on any tests changed\r\n- [ ] The PR description includes the appropriate Release Notes section,\r\nand the correct `release_note:*` label is applied per the\r\n[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)\r\n\r\n### Identify risks\r\n\r\nDoes this PR introduce any risks? For example, consider risks like hard\r\nto test bugs, performance regression, potential of data loss.\r\n\r\nDescribe the risk, its severity, and mitigation for each identified\r\nrisk. Invite stakeholders and evaluate how to proceed before merging.\r\n\r\n- [ ] [See some risk\r\nexamples](https://github.com/elastic/kibana/blob/main/RISK_MATRIX.mdx)\r\n- [ ] ...\r\n\r\n-->\r\n\r\nCo-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>","sha":"e7b5f3d84401ca0861b8d18588277e1d11e188ba","branchLabelMapping":{"^v9.0.0$":"main","^v8.18.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","v9.0.0","Team:SharedUX","backport:prev-minor","React@18"],"title":"fix tty and related tests","number":206919,"url":"https://github.com/elastic/kibana/pull/206919","mergeCommit":{"message":"fix tty and related tests (#206919)\n\n## Summary\r\n\r\nCulled from https://github.com/elastic/kibana/pull/206411\r\n\r\nThis PR is informed from the work that's being done for the migration to\r\nReact 18, whilst trying out kibana with react 18 we had couple of test\r\nfail relating to this particular component, details here\r\n[[job]](https://buildkite.com/elastic/kibana-pull-request/builds/266993#0194655f-1466-4ee3-80ed-54e398b09492)\r\n[[logs]](https://buildkite.com/organizations/elastic/pipelines/kibana-pull-request/builds/266993/jobs/0194655f-1466-4ee3-80ed-54e398b09492/artifacts/01946583-34ed-444a-bc55-10e684c325ef),\r\nit's worth mentioning the way the component was written causes\r\nunnecessary re-renders that doesn't actually make the interval for the\r\ntty playspeed exactly constant. The approach taken here is such that\r\nthere's no need to depend on state change to cause the next line to be\r\nwritten, now we setup a timer interval just once for the entire duration\r\nthat the tty is playing, and said timer only ever gets cleaned up on\r\npause.\r\n\r\n\r\nP.S. This fix does not utilize any APIs from react 18 so it's backward\r\ncompatible with our current version of react.\r\n\r\n### Checklist\r\n\r\n<!-- Check the PR satisfies following conditions. \r\n\r\nReviewers should verify this PR satisfies this list as well.\r\n\r\n- [ ] Any text added follows [EUI's writing\r\nguidelines](https://elastic.github.io/eui/#/guidelines/writing), uses\r\nsentence case text and includes [i18n\r\nsupport](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-i18n/README.md)\r\n- [ ]\r\n[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)\r\nwas added for features that require explanation or tutorials -->\r\n- [x] [Unit or functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere updated or added to match the most common scenarios\r\n<!--\r\n- [ ] If a plugin configuration key changed, check if it needs to be\r\nallowlisted in the cloud and added to the [docker\r\nlist](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)\r\n- [ ] This was checked for breaking HTTP API changes, and any breaking\r\nchanges have been approved by the breaking-change committee. The\r\n`release_note:breaking` label should be applied in these situations.\r\n- [ ] [Flaky Test\r\nRunner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was\r\nused on any tests changed\r\n- [ ] The PR description includes the appropriate Release Notes section,\r\nand the correct `release_note:*` label is applied per the\r\n[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)\r\n\r\n### Identify risks\r\n\r\nDoes this PR introduce any risks? For example, consider risks like hard\r\nto test bugs, performance regression, potential of data loss.\r\n\r\nDescribe the risk, its severity, and mitigation for each identified\r\nrisk. Invite stakeholders and evaluate how to proceed before merging.\r\n\r\n- [ ] [See some risk\r\nexamples](https://github.com/elastic/kibana/blob/main/RISK_MATRIX.mdx)\r\n- [ ] ...\r\n\r\n-->\r\n\r\nCo-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>","sha":"e7b5f3d84401ca0861b8d18588277e1d11e188ba"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/206919","number":206919,"mergeCommit":{"message":"fix tty and related tests (#206919)\n\n## Summary\r\n\r\nCulled from https://github.com/elastic/kibana/pull/206411\r\n\r\nThis PR is informed from the work that's being done for the migration to\r\nReact 18, whilst trying out kibana with react 18 we had couple of test\r\nfail relating to this particular component, details here\r\n[[job]](https://buildkite.com/elastic/kibana-pull-request/builds/266993#0194655f-1466-4ee3-80ed-54e398b09492)\r\n[[logs]](https://buildkite.com/organizations/elastic/pipelines/kibana-pull-request/builds/266993/jobs/0194655f-1466-4ee3-80ed-54e398b09492/artifacts/01946583-34ed-444a-bc55-10e684c325ef),\r\nit's worth mentioning the way the component was written causes\r\nunnecessary re-renders that doesn't actually make the interval for the\r\ntty playspeed exactly constant. The approach taken here is such that\r\nthere's no need to depend on state change to cause the next line to be\r\nwritten, now we setup a timer interval just once for the entire duration\r\nthat the tty is playing, and said timer only ever gets cleaned up on\r\npause.\r\n\r\n\r\nP.S. This fix does not utilize any APIs from react 18 so it's backward\r\ncompatible with our current version of react.\r\n\r\n### Checklist\r\n\r\n<!-- Check the PR satisfies following conditions. \r\n\r\nReviewers should verify this PR satisfies this list as well.\r\n\r\n- [ ] Any text added follows [EUI's writing\r\nguidelines](https://elastic.github.io/eui/#/guidelines/writing), uses\r\nsentence case text and includes [i18n\r\nsupport](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-i18n/README.md)\r\n- [ ]\r\n[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)\r\nwas added for features that require explanation or tutorials -->\r\n- [x] [Unit or functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere updated or added to match the most common scenarios\r\n<!--\r\n- [ ] If a plugin configuration key changed, check if it needs to be\r\nallowlisted in the cloud and added to the [docker\r\nlist](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)\r\n- [ ] This was checked for breaking HTTP API changes, and any breaking\r\nchanges have been approved by the breaking-change committee. The\r\n`release_note:breaking` label should be applied in these situations.\r\n- [ ] [Flaky Test\r\nRunner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was\r\nused on any tests changed\r\n- [ ] The PR description includes the appropriate Release Notes section,\r\nand the correct `release_note:*` label is applied per the\r\n[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)\r\n\r\n### Identify risks\r\n\r\nDoes this PR introduce any risks? For example, consider risks like hard\r\nto test bugs, performance regression, potential of data loss.\r\n\r\nDescribe the risk, its severity, and mitigation for each identified\r\nrisk. Invite stakeholders and evaluate how to proceed before merging.\r\n\r\n- [ ] [See some risk\r\nexamples](https://github.com/elastic/kibana/blob/main/RISK_MATRIX.mdx)\r\n- [ ] ...\r\n\r\n-->\r\n\r\nCo-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>","sha":"e7b5f3d84401ca0861b8d18588277e1d11e188ba"}}]}] BACKPORT--> Co-authored-by: Eyo O. Eyo <7893459+eokoneyo@users.noreply.github.com>
## Summary Culled from elastic#206411 This PR is informed from the work that's being done for the migration to React 18, whilst trying out kibana with react 18 we had couple of test fail relating to this particular component, details here [[job]](https://buildkite.com/elastic/kibana-pull-request/builds/266993#0194655f-1466-4ee3-80ed-54e398b09492) [[logs]](https://buildkite.com/organizations/elastic/pipelines/kibana-pull-request/builds/266993/jobs/0194655f-1466-4ee3-80ed-54e398b09492/artifacts/01946583-34ed-444a-bc55-10e684c325ef), it's worth mentioning the way the component was written causes unnecessary re-renders that doesn't actually make the interval for the tty playspeed exactly constant. The approach taken here is such that there's no need to depend on state change to cause the next line to be written, now we setup a timer interval just once for the entire duration that the tty is playing, and said timer only ever gets cleaned up on pause. P.S. This fix does not utilize any APIs from react 18 so it's backward compatible with our current version of react. ### Checklist <!-- Check the PR satisfies following conditions. Reviewers should verify this PR satisfies this list as well. - [ ] Any text added follows [EUI's writing guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses sentence case text and includes [i18n support](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-i18n/README.md) - [ ] [Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html) was added for features that require explanation or tutorials --> - [x] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios <!-- - [ ] If a plugin configuration key changed, check if it needs to be allowlisted in the cloud and added to the [docker list](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker) - [ ] This was checked for breaking HTTP API changes, and any breaking changes have been approved by the breaking-change committee. The `release_note:breaking` label should be applied in these situations. - [ ] [Flaky Test Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was used on any tests changed - [ ] The PR description includes the appropriate Release Notes section, and the correct `release_note:*` label is applied per the [guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process) ### Identify risks Does this PR introduce any risks? For example, consider risks like hard to test bugs, performance regression, potential of data loss. Describe the risk, its severity, and mitigation for each identified risk. Invite stakeholders and evaluate how to proceed before merging. - [ ] [See some risk examples](https://github.com/elastic/kibana/blob/main/RISK_MATRIX.mdx) - [ ] ... --> Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
## Summary Culled from elastic#206411 This PR is informed from the work that's being done for the migration to React 18, whilst trying out kibana with react 18 we had couple of test fail relating to this particular component, details here [[job]](https://buildkite.com/elastic/kibana-pull-request/builds/266993#0194655f-1466-4ee3-80ed-54e398b09492) [[logs]](https://buildkite.com/organizations/elastic/pipelines/kibana-pull-request/builds/266993/jobs/0194655f-1466-4ee3-80ed-54e398b09492/artifacts/01946583-34ed-444a-bc55-10e684c325ef), it's worth mentioning the way the component was written causes unnecessary re-renders that doesn't actually make the interval for the tty playspeed exactly constant. The approach taken here is such that there's no need to depend on state change to cause the next line to be written, now we setup a timer interval just once for the entire duration that the tty is playing, and said timer only ever gets cleaned up on pause. P.S. This fix does not utilize any APIs from react 18 so it's backward compatible with our current version of react. ### Checklist <!-- Check the PR satisfies following conditions. Reviewers should verify this PR satisfies this list as well. - [ ] Any text added follows [EUI's writing guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses sentence case text and includes [i18n support](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-i18n/README.md) - [ ] [Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html) was added for features that require explanation or tutorials --> - [x] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios <!-- - [ ] If a plugin configuration key changed, check if it needs to be allowlisted in the cloud and added to the [docker list](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker) - [ ] This was checked for breaking HTTP API changes, and any breaking changes have been approved by the breaking-change committee. The `release_note:breaking` label should be applied in these situations. - [ ] [Flaky Test Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was used on any tests changed - [ ] The PR description includes the appropriate Release Notes section, and the correct `release_note:*` label is applied per the [guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process) ### Identify risks Does this PR introduce any risks? For example, consider risks like hard to test bugs, performance regression, potential of data loss. Describe the risk, its severity, and mitigation for each identified risk. Invite stakeholders and evaluate how to proceed before merging. - [ ] [See some risk examples](https://github.com/elastic/kibana/blob/main/RISK_MATRIX.mdx) - [ ] ... --> Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
## Summary This piece was left out from the #206919 (I assume by mistake) this waitFor is needed for testing passing with React@18, see https://github.com/elastic/kibana/pull/208339/files#diff-bf9743a8d3aa8ed102d36f9117fb14e455efa23df7da28a4ac44b7efa270899a ``` REACT_18=true yarn test:jest x-pack/solutions/security/plugins/session_view/public/components/tty_player/hooks.test.tsx ```
## Summary This piece was left out from the elastic#206919 (I assume by mistake) this waitFor is needed for testing passing with React@18, see https://github.com/elastic/kibana/pull/208339/files#diff-bf9743a8d3aa8ed102d36f9117fb14e455efa23df7da28a4ac44b7efa270899a ``` REACT_18=true yarn test:jest x-pack/solutions/security/plugins/session_view/public/components/tty_player/hooks.test.tsx ``` (cherry picked from commit fc179a8)
# Backport This will backport the following commits from `main` to `8.x`: - [[React@18] follow up fix tty test (#208393)](#208393) <!--- Backport version: 9.4.3 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) <!--BACKPORT [{"author":{"name":"Anton Dosov","email":"anton.dosov@elastic.co"},"sourceCommit":{"committedDate":"2025-01-28T11:08:17Z","message":"[React@18] follow up fix tty test (#208393)\n\n## Summary\r\n\r\nThis piece was left out from the\r\nhttps://github.com//pull/206919 (I assume by mistake)\r\nthis waitFor is needed for testing passing with React@18, see\r\nhttps://github.com//pull/208339/files#diff-bf9743a8d3aa8ed102d36f9117fb14e455efa23df7da28a4ac44b7efa270899a\r\n\r\n\r\n```\r\nREACT_18=true yarn test:jest x-pack/solutions/security/plugins/session_view/public/components/tty_player/hooks.test.tsx\r\n```","sha":"fc179a8d47b7a7ab622dfce519154175b1821869","branchLabelMapping":{"^v9.0.0$":"main","^v8.18.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","v9.0.0","Team:SharedUX","backport:prev-minor","React@18"],"title":"[React@18] follow up fix tty test","number":208393,"url":"https://github.com/elastic/kibana/pull/208393","mergeCommit":{"message":"[React@18] follow up fix tty test (#208393)\n\n## Summary\r\n\r\nThis piece was left out from the\r\nhttps://github.com//pull/206919 (I assume by mistake)\r\nthis waitFor is needed for testing passing with React@18, see\r\nhttps://github.com//pull/208339/files#diff-bf9743a8d3aa8ed102d36f9117fb14e455efa23df7da28a4ac44b7efa270899a\r\n\r\n\r\n```\r\nREACT_18=true yarn test:jest x-pack/solutions/security/plugins/session_view/public/components/tty_player/hooks.test.tsx\r\n```","sha":"fc179a8d47b7a7ab622dfce519154175b1821869"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/208393","number":208393,"mergeCommit":{"message":"[React@18] follow up fix tty test (#208393)\n\n## Summary\r\n\r\nThis piece was left out from the\r\nhttps://github.com//pull/206919 (I assume by mistake)\r\nthis waitFor is needed for testing passing with React@18, see\r\nhttps://github.com//pull/208339/files#diff-bf9743a8d3aa8ed102d36f9117fb14e455efa23df7da28a4ac44b7efa270899a\r\n\r\n\r\n```\r\nREACT_18=true yarn test:jest x-pack/solutions/security/plugins/session_view/public/components/tty_player/hooks.test.tsx\r\n```","sha":"fc179a8d47b7a7ab622dfce519154175b1821869"}}]}] BACKPORT--> Co-authored-by: Anton Dosov <anton.dosov@elastic.co>
Summary
Culled from #206411
This PR is informed from the work that's being done for the migration to React 18, whilst trying out kibana with react 18 we had couple of test fail relating to this particular component, details here [job] [logs], it's worth mentioning the way the component was written causes unnecessary re-renders that doesn't actually make the interval for the tty playspeed exactly constant. The approach taken here is such that there's no need to depend on state change to cause the next line to be written, now we setup a timer interval just once for the entire duration that the tty is playing, and said timer only ever gets cleaned up on pause.
P.S. This fix does not utilize any APIs from react 18 so it's backward compatible with our current version of react.
Checklist