-
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 context.pageName by fixing missing executionContext and add enableExecutionContextTracking flag #204547
Fix context.pageName by fixing missing executionContext and add enableExecutionContextTracking flag #204547
Changes from 21 commits
3925c21
d0b0d51
b0c621c
dcc81b8
68cae60
3f82e98
87ae813
89b004b
81a712c
7e4df5d
2a5a780
7c85f18
a83ff91
899a3fe
1fc0b38
7a04db2
79586d6
6ebfcf3
b22b5b8
e23b561
9b3532c
c56ab90
53a7e9a
2e2eb1f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
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"], | ||
) |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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>); |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -50,7 +50,7 @@ export interface SharedUXExecutionContextSetup { | |
*/ | ||
export interface SharedUXExecutionContextSetup { | ||
/** {@link SharedUXExecutionContextSetup} */ | ||
executionContext: SharedUXExecutionContextStart; | ||
executionContext?: SharedUXExecutionContextStart; | ||
} | ||
|
||
export type KibanaServices = Partial<SharedUXExecutionContextSetup>; | ||
|
@@ -63,12 +63,12 @@ const defaultContextValue = { | |
services: {}, | ||
}; | ||
|
||
export const sharedUXContext = | ||
export const SharedUXContext = | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we please rename this into There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Changed in c56ab90 |
||
createContext<SharedUXRouterContextValue<KibanaServices>>(defaultContextValue); | ||
|
||
export const useKibanaSharedUX = <Extra extends object = {}>(): SharedUXRouterContextValue< | ||
KibanaServices & Extra | ||
> => | ||
useContext( | ||
sharedUXContext as unknown as React.Context<SharedUXRouterContextValue<KibanaServices & Extra>> | ||
SharedUXContext as unknown as React.Context<SharedUXRouterContextValue<KibanaServices & Extra>> | ||
); |
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.
do we need this here? Seems like this will also be called inside
<Route/>
componentThere 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.
I don't think so, but I am not sure how to verify that. Would you mind checking it? If you and your team don't see a use case for it, I can remove it, but I am not sure why it was added in the first place.
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.
I double-checked. Agree that we should keep it here