Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[8.x] do not set full screen mode on ExitFullScreenButton re-render (e…
…lastic#198012) (elastic#198059) # Backport This will backport the following commits from `main` to `8.x`: - [do not set full screen mode on ExitFullScreenButton re-render (elastic#198012)](elastic#198012) <!--- Backport version: 9.4.3 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) <!--BACKPORT [{"author":{"name":"Nathan Reese","email":"[email protected]"},"sourceCommit":{"committedDate":"2024-10-28T17:21:25Z","message":"do not set full screen mode on ExitFullScreenButton re-render (elastic#198012)\n\n### Background\r\nhttps://github.com/elastic/pull/194892 is refactoring\r\n[DashboardRenderer](https://github.com/elastic/kibana/blob/3391344e8dc8377d359b918521b6c48838cde8ae/src/plugins/dashboard/public/dashboard_container/external_api/dashboard_renderer.tsx)\r\ncomponent to replace Dashboard Embeddable with a plain old javascript\r\nobject. Dashboard Embeddable rendered its contents in a new react tree.\r\nThe new implementation does not. Since the new implementation does not\r\nrender the dashboard in a new react tree, any re-render in\r\n`DashboardViewport` parent components causes `ExitFullScreenButton` to\r\nre-render. In its current form, re-rendering `ExitFullScreenButton`\r\ncalls `onExit`, which causing dashboard to exit full screen mode.\r\n\r\nThis PR makes use of `useCallback` to fix the issue where re-rending\r\n`ExitFullScreenButton` calls `onExit`.\r\n\r\n### Test steps\r\n1) Open dashboard that ships with sample web logs data set\r\n2) switch to view mode\r\n3) click \"Full screen\" button\r\n4) Maximize a panel. Verify dashboard stays in full screen mode.","sha":"9e9a6bb07dc3a5424a4a369709bf91f6d547361e","branchLabelMapping":{"^v9.0.0$":"main","^v8.17.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["Team:Presentation","release_note:skip","v9.0.0","project:embeddableRebuild","backport:version","v8.17.0"],"title":"do not set full screen mode on ExitFullScreenButton re-render","number":198012,"url":"https://github.com/elastic/kibana/pull/198012","mergeCommit":{"message":"do not set full screen mode on ExitFullScreenButton re-render (elastic#198012)\n\n### Background\r\nhttps://github.com/elastic/pull/194892 is refactoring\r\n[DashboardRenderer](https://github.com/elastic/kibana/blob/3391344e8dc8377d359b918521b6c48838cde8ae/src/plugins/dashboard/public/dashboard_container/external_api/dashboard_renderer.tsx)\r\ncomponent to replace Dashboard Embeddable with a plain old javascript\r\nobject. Dashboard Embeddable rendered its contents in a new react tree.\r\nThe new implementation does not. Since the new implementation does not\r\nrender the dashboard in a new react tree, any re-render in\r\n`DashboardViewport` parent components causes `ExitFullScreenButton` to\r\nre-render. In its current form, re-rendering `ExitFullScreenButton`\r\ncalls `onExit`, which causing dashboard to exit full screen mode.\r\n\r\nThis PR makes use of `useCallback` to fix the issue where re-rending\r\n`ExitFullScreenButton` calls `onExit`.\r\n\r\n### Test steps\r\n1) Open dashboard that ships with sample web logs data set\r\n2) switch to view mode\r\n3) click \"Full screen\" button\r\n4) Maximize a panel. Verify dashboard stays in full screen mode.","sha":"9e9a6bb07dc3a5424a4a369709bf91f6d547361e"}},"sourceBranch":"main","suggestedTargetBranches":["8.x"],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/198012","number":198012,"mergeCommit":{"message":"do not set full screen mode on ExitFullScreenButton re-render (elastic#198012)\n\n### Background\r\nhttps://github.com/elastic/pull/194892 is refactoring\r\n[DashboardRenderer](https://github.com/elastic/kibana/blob/3391344e8dc8377d359b918521b6c48838cde8ae/src/plugins/dashboard/public/dashboard_container/external_api/dashboard_renderer.tsx)\r\ncomponent to replace Dashboard Embeddable with a plain old javascript\r\nobject. Dashboard Embeddable rendered its contents in a new react tree.\r\nThe new implementation does not. Since the new implementation does not\r\nrender the dashboard in a new react tree, any re-render in\r\n`DashboardViewport` parent components causes `ExitFullScreenButton` to\r\nre-render. In its current form, re-rendering `ExitFullScreenButton`\r\ncalls `onExit`, which causing dashboard to exit full screen mode.\r\n\r\nThis PR makes use of `useCallback` to fix the issue where re-rending\r\n`ExitFullScreenButton` calls `onExit`.\r\n\r\n### Test steps\r\n1) Open dashboard that ships with sample web logs data set\r\n2) switch to view mode\r\n3) click \"Full screen\" button\r\n4) Maximize a panel. Verify dashboard stays in full screen mode.","sha":"9e9a6bb07dc3a5424a4a369709bf91f6d547361e"}},{"branch":"8.x","label":"v8.17.0","branchLabelMappingKey":"^v8.17.0$","isSourceBranch":false,"state":"NOT_CREATED"}]}] BACKPORT--> Co-authored-by: Nathan Reese <[email protected]>
- Loading branch information