Commit 79cc21e
# Backport
This will backport the following commits from `main` to `8.x`:
- [[embeddable] fix race condition in useBatchedPublishingSubjects
(#216399)](#216399)
<!--- Backport version: 9.6.6 -->
### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sorenlouv/backport)
<!--BACKPORT [{"author":{"name":"Nathan
Reese","email":"[email protected]"},"sourceCommit":{"committedDate":"2025-03-31T17:21:56Z","message":"[embeddable]
fix race condition in useBatchedPublishingSubjects (#216399)\n\nCloses
#214176
and\nhttps://github.com//issues/214853\n\n[upgrade from
chrome 134 to 135 in functional
test\nrunner](#213919) revealed
a race\ncondition in `useBatchedPublishingSubjects` where batched
observables\ncould emit new values before `useEffect` sets up the
subscription. This\nPR resolves this issue by setting up subscription in
useRef, which has\nno timing delays.\n\nIn chrome 134,
`useBatchedPublishingSubjects` `useEffect` gets called\n(setting up
subscription) before lens embeddable emits any changes to\nbatched
observables.\n<img width=\"300\"
alt=\"chrome134\"\nsrc=\"https://github.com/user-attachments/assets/b0356f74-e0c7-4d93-a23a-ace519194d5d\"\n/>\n\nIn
chrome 135, `useBatchedPublishingSubjects` `useEffect` gets
called\nafter lens embeddable emits changes to batched observables. This
causes\nthe lens embeddable to not render since the
`LensEmbeddableComponent`\nhas a stale value for
`expressionParams`.\n<img width=\"300\"
alt=\"chrome135\"\nsrc=\"https://github.com/user-attachments/assets/320bfb7e-8b3f-4b48-a138-1c47c5ff9961\"\n/>\n\n---------\n\nCo-authored-by:
Elastic Machine
<[email protected]>\nCo-authored-by: kibanamachine
<[email protected]>","sha":"f408a513dd5fdecf5ebbc4e3265e1b998421d39b","branchLabelMapping":{"^v9.1.0$":"main","^v8.19.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:fix","Team:Presentation","backport:version","v8.18.0","v9.1.0","v8.19.0","v9.0.1","v8.17.5","v8.16.7"],"title":"[embeddable]
fix race condition in
useBatchedPublishingSubjects","number":216399,"url":"https://github.com/elastic/kibana/pull/216399","mergeCommit":{"message":"[embeddable]
fix race condition in useBatchedPublishingSubjects (#216399)\n\nCloses
#214176
and\nhttps://github.com//issues/214853\n\n[upgrade from
chrome 134 to 135 in functional
test\nrunner](#213919) revealed
a race\ncondition in `useBatchedPublishingSubjects` where batched
observables\ncould emit new values before `useEffect` sets up the
subscription. This\nPR resolves this issue by setting up subscription in
useRef, which has\nno timing delays.\n\nIn chrome 134,
`useBatchedPublishingSubjects` `useEffect` gets called\n(setting up
subscription) before lens embeddable emits any changes to\nbatched
observables.\n<img width=\"300\"
alt=\"chrome134\"\nsrc=\"https://github.com/user-attachments/assets/b0356f74-e0c7-4d93-a23a-ace519194d5d\"\n/>\n\nIn
chrome 135, `useBatchedPublishingSubjects` `useEffect` gets
called\nafter lens embeddable emits changes to batched observables. This
causes\nthe lens embeddable to not render since the
`LensEmbeddableComponent`\nhas a stale value for
`expressionParams`.\n<img width=\"300\"
alt=\"chrome135\"\nsrc=\"https://github.com/user-attachments/assets/320bfb7e-8b3f-4b48-a138-1c47c5ff9961\"\n/>\n\n---------\n\nCo-authored-by:
Elastic Machine
<[email protected]>\nCo-authored-by: kibanamachine
<[email protected]>","sha":"f408a513dd5fdecf5ebbc4e3265e1b998421d39b"}},"sourceBranch":"main","suggestedTargetBranches":["8.18","8.x","9.0","8.17","8.16"],"targetPullRequestStates":[{"branch":"8.18","label":"v8.18.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v9.1.0","branchLabelMappingKey":"^v9.1.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/216399","number":216399,"mergeCommit":{"message":"[embeddable]
fix race condition in useBatchedPublishingSubjects (#216399)\n\nCloses
#214176
and\nhttps://github.com//issues/214853\n\n[upgrade from
chrome 134 to 135 in functional
test\nrunner](#213919) revealed
a race\ncondition in `useBatchedPublishingSubjects` where batched
observables\ncould emit new values before `useEffect` sets up the
subscription. This\nPR resolves this issue by setting up subscription in
useRef, which has\nno timing delays.\n\nIn chrome 134,
`useBatchedPublishingSubjects` `useEffect` gets called\n(setting up
subscription) before lens embeddable emits any changes to\nbatched
observables.\n<img width=\"300\"
alt=\"chrome134\"\nsrc=\"https://github.com/user-attachments/assets/b0356f74-e0c7-4d93-a23a-ace519194d5d\"\n/>\n\nIn
chrome 135, `useBatchedPublishingSubjects` `useEffect` gets
called\nafter lens embeddable emits changes to batched observables. This
causes\nthe lens embeddable to not render since the
`LensEmbeddableComponent`\nhas a stale value for
`expressionParams`.\n<img width=\"300\"
alt=\"chrome135\"\nsrc=\"https://github.com/user-attachments/assets/320bfb7e-8b3f-4b48-a138-1c47c5ff9961\"\n/>\n\n---------\n\nCo-authored-by:
Elastic Machine
<[email protected]>\nCo-authored-by: kibanamachine
<[email protected]>","sha":"f408a513dd5fdecf5ebbc4e3265e1b998421d39b"}},{"branch":"8.x","label":"v8.19.0","branchLabelMappingKey":"^v8.19.0$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"9.0","label":"v9.0.1","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.17","label":"v8.17.5","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.16","label":"v8.16.7","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->
Co-authored-by: Nathan Reese <[email protected]>
1 parent 3832386 commit 79cc21e
File tree
2 files changed
+52
-13
lines changed2 files changed
+52
-13
lines changedLines changed: 28 additions & 13 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | | - | |
| 10 | + | |
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| |||
120 | 120 | | |
121 | 121 | | |
122 | 122 | | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
123 | 130 | | |
124 | | - | |
125 | | - | |
126 | | - | |
127 | | - | |
128 | | - | |
129 | | - | |
130 | | - | |
131 | | - | |
132 | | - | |
133 | | - | |
134 | | - | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
135 | 142 | | |
136 | 143 | | |
137 | 144 | | |
138 | | - | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
139 | 154 | | |
140 | 155 | | |
141 | 156 | | |
| |||
Lines changed: 24 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
118 | 118 | | |
119 | 119 | | |
120 | 120 | | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
121 | 145 | | |
122 | 146 | | |
123 | 147 | | |
| |||
0 commit comments