-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[8.x] Fix context.pageName by fixing missing executionContext and add…
… enableExecutionContextTracking flag (#204547) (#204798) # Backport This will backport the following commits from `main` to `8.x`: - [Fix context.pageName by fixing missing executionContext and add enableExecutionContextTracking flag (#204547)](#204547) <!--- Backport version: 8.9.8 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) <!--BACKPORT [{"author":{"name":"Maryam Saeidi","email":"[email protected]"},"sourceCommit":{"committedDate":"2024-12-18T12:59:23Z","message":"Fix context.pageName by fixing missing executionContext and add enableExecutionContextTracking flag (#204547)\n\nResolves https://github.com/elastic/kibana/issues/195778\r\n\r\n## 🐞 Summary\r\nThis PR fixes missing executionContext in sharedux router by adding\r\n`SharedUXContext` to the `KibanaRootContextProvider` (inside of the\r\n`KibanaRenderContextProvider`). (More context provided in this\r\nhttps://github.com//issues/195778#issuecomment-2426936142)\r\n\r\nIt also introduces `enableExecutionContextTracking` to enable tracking\r\nlogic to avoid creating a race condition for the existing custom\r\nexecution context tracking implementations.\r\n\r\nI enabled this flag for the observability plugin and here is the\r\ndifference:\r\n\r\n|Item|Screenshot|\r\n|---|---|\r\n\r\n|Before|![image](https://github.com/user-attachments/assets/83283d23-3347-45be-95c1-120cdfabb9c5)|\r\n\r\n|After|![image](https://github.com/user-attachments/assets/9de51645-6bf1-4537-baeb-6878e7bb3590)|\r\n\r\n### 🧪 How to test\r\n- Go to the observability alerts page and check the kibana-browser\r\nrequest as shown above\r\n\r\n### ✨ Possible future improvements\r\n\r\nAllowing this logic to be provided by the consumer so that we can get\r\nrid of custom implementations (Example: [APM custom execution\r\ncontext](https://github.com/elastic/kibana/blob/e9671937bacfaa911d32de0e8885e7f26425888a/x-pack/plugins/observability_solution/apm/public/components/routing/app_root/update_execution_context_on_route_change.ts#L21,L25))\r\n\r\n---------\r\n\r\nCo-authored-by: Anton Dosov <[email protected]>\r\nCo-authored-by: Davis McPhee <[email protected]>\r\nCo-authored-by: Marco Antonio Ghiani <[email protected]>\r\nCo-authored-by: Elena Stoeva <[email protected]>","sha":"53748fdefa1d59d58a4708258a1476dc140b1588","branchLabelMapping":{"^v9.0.0$":"main","^v8.18.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","v9.0.0","backport:prev-minor","Team:obs-ux-management"],"number":204547,"url":"https://github.com/elastic/kibana/pull/204547","mergeCommit":{"message":"Fix context.pageName by fixing missing executionContext and add enableExecutionContextTracking flag (#204547)\n\nResolves https://github.com/elastic/kibana/issues/195778\r\n\r\n## 🐞 Summary\r\nThis PR fixes missing executionContext in sharedux router by adding\r\n`SharedUXContext` to the `KibanaRootContextProvider` (inside of the\r\n`KibanaRenderContextProvider`). (More context provided in this\r\nhttps://github.com//issues/195778#issuecomment-2426936142)\r\n\r\nIt also introduces `enableExecutionContextTracking` to enable tracking\r\nlogic to avoid creating a race condition for the existing custom\r\nexecution context tracking implementations.\r\n\r\nI enabled this flag for the observability plugin and here is the\r\ndifference:\r\n\r\n|Item|Screenshot|\r\n|---|---|\r\n\r\n|Before|![image](https://github.com/user-attachments/assets/83283d23-3347-45be-95c1-120cdfabb9c5)|\r\n\r\n|After|![image](https://github.com/user-attachments/assets/9de51645-6bf1-4537-baeb-6878e7bb3590)|\r\n\r\n### 🧪 How to test\r\n- Go to the observability alerts page and check the kibana-browser\r\nrequest as shown above\r\n\r\n### ✨ Possible future improvements\r\n\r\nAllowing this logic to be provided by the consumer so that we can get\r\nrid of custom implementations (Example: [APM custom execution\r\ncontext](https://github.com/elastic/kibana/blob/e9671937bacfaa911d32de0e8885e7f26425888a/x-pack/plugins/observability_solution/apm/public/components/routing/app_root/update_execution_context_on_route_change.ts#L21,L25))\r\n\r\n---------\r\n\r\nCo-authored-by: Anton Dosov <[email protected]>\r\nCo-authored-by: Davis McPhee <[email protected]>\r\nCo-authored-by: Marco Antonio Ghiani <[email protected]>\r\nCo-authored-by: Elena Stoeva <[email protected]>","sha":"53748fdefa1d59d58a4708258a1476dc140b1588"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","labelRegex":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/204547","number":204547,"mergeCommit":{"message":"Fix context.pageName by fixing missing executionContext and add enableExecutionContextTracking flag (#204547)\n\nResolves https://github.com/elastic/kibana/issues/195778\r\n\r\n## 🐞 Summary\r\nThis PR fixes missing executionContext in sharedux router by adding\r\n`SharedUXContext` to the `KibanaRootContextProvider` (inside of the\r\n`KibanaRenderContextProvider`). (More context provided in this\r\nhttps://github.com//issues/195778#issuecomment-2426936142)\r\n\r\nIt also introduces `enableExecutionContextTracking` to enable tracking\r\nlogic to avoid creating a race condition for the existing custom\r\nexecution context tracking implementations.\r\n\r\nI enabled this flag for the observability plugin and here is the\r\ndifference:\r\n\r\n|Item|Screenshot|\r\n|---|---|\r\n\r\n|Before|![image](https://github.com/user-attachments/assets/83283d23-3347-45be-95c1-120cdfabb9c5)|\r\n\r\n|After|![image](https://github.com/user-attachments/assets/9de51645-6bf1-4537-baeb-6878e7bb3590)|\r\n\r\n### 🧪 How to test\r\n- Go to the observability alerts page and check the kibana-browser\r\nrequest as shown above\r\n\r\n### ✨ Possible future improvements\r\n\r\nAllowing this logic to be provided by the consumer so that we can get\r\nrid of custom implementations (Example: [APM custom execution\r\ncontext](https://github.com/elastic/kibana/blob/e9671937bacfaa911d32de0e8885e7f26425888a/x-pack/plugins/observability_solution/apm/public/components/routing/app_root/update_execution_context_on_route_change.ts#L21,L25))\r\n\r\n---------\r\n\r\nCo-authored-by: Anton Dosov <[email protected]>\r\nCo-authored-by: Davis McPhee <[email protected]>\r\nCo-authored-by: Marco Antonio Ghiani <[email protected]>\r\nCo-authored-by: Elena Stoeva <[email protected]>","sha":"53748fdefa1d59d58a4708258a1476dc140b1588"}}]}] BACKPORT-->
- Loading branch information
1 parent
7dcfba5
commit 1665216
Showing
15 changed files
with
159 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
load("@build_bazel_rules_nodejs//:index.bzl", "js_library") | ||
|
||
SRCS = glob( | ||
[ | ||
"**/*.ts", | ||
"**/*.tsx", | ||
], | ||
exclude = [ | ||
"**/test_helpers.ts", | ||
"**/*.config.js", | ||
"**/*.mock.*", | ||
"**/*.test.*", | ||
"**/*.stories.*", | ||
"**/__snapshots__/**", | ||
"**/integration_tests/**", | ||
"**/mocks/**", | ||
"**/scripts/**", | ||
"**/storybook/**", | ||
"**/test_fixtures/**", | ||
"**/test_helpers/**", | ||
], | ||
) | ||
|
||
DEPS = [ | ||
|
||
] | ||
|
||
js_library( | ||
name = "shared-ux-router", | ||
package_name = "@kbn/shared-ux-router", | ||
srcs = ["package.json"] + SRCS, | ||
deps = DEPS, | ||
visibility = ["//visibility:public"], | ||
) |
2 changes: 2 additions & 0 deletions
2
packages/shared-ux/router/impl/__snapshots__/route.test.tsx.snap
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the "Elastic License | ||
* 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side | ||
* Public License v 1"; you may not use this file except in compliance with, at | ||
* your election, the "Elastic License 2.0", the "GNU Affero General Public | ||
* License v3.0 only", or the "Server Side Public License, v 1". | ||
*/ | ||
|
||
import { createContext, useContext } from 'react'; | ||
import { SharedUXRoutesContextType } from './types'; | ||
|
||
const defaultContextValue = {}; | ||
|
||
export const SharedUXRoutesContext = createContext<SharedUXRoutesContextType>(defaultContextValue); | ||
|
||
export const useSharedUXRoutesContext = (): SharedUXRoutesContextType => | ||
useContext(SharedUXRoutesContext as unknown as React.Context<SharedUXRoutesContextType>); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.