Skip to content

Commit

Permalink
[8.x] [KibanaRootContextProvider] destructure the params to KibanaEui…
Browse files Browse the repository at this point in the history
…Provider (elastic#203303) (elastic#203347)

# Backport

This will backport the following commits from `main` to `8.x`:
- [[KibanaRootContextProvider] destructure the params to
KibanaEuiProvider
(elastic#203303)](elastic#203303)

<!--- Backport version: 9.4.3 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Tim
Sullivan","email":"[email protected]"},"sourceCommit":{"committedDate":"2024-12-06T22:06:59Z","message":"[KibanaRootContextProvider]
destructure the params to KibanaEuiProvider (elastic#203303)\n\n##
Summary\r\n\r\nAddresses:\r\nhttps://github.com/elastic/pull/202606#discussion_r1871947907\r\n\r\nThis
discards the\r\n> unused portions of core, before adding them to the
context value, but\r\nstill allow people to pass the entire construct if
we were to need\r\nsomething else\r\n\r\ncc @clintandrewhall
\r\n\r\n----\r\n\r\n### Checklist\r\n\r\nCheck the PR satisfies
following conditions. \r\n\r\nReviewers should verify this PR satisfies
this list as well.\r\n\r\n**none**\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**none**\r\n\r\n---------\r\n\r\nCo-authored-by:
kibanamachine
<[email protected]>","sha":"79e731685ad4af8cabd4c6eb13aa70a6c23d556e","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"],"title":"[KibanaRootContextProvider]
destructure the params to
KibanaEuiProvider","number":203303,"url":"https://github.com/elastic/kibana/pull/203303","mergeCommit":{"message":"[KibanaRootContextProvider]
destructure the params to KibanaEuiProvider (elastic#203303)\n\n##
Summary\r\n\r\nAddresses:\r\nhttps://github.com/elastic/pull/202606#discussion_r1871947907\r\n\r\nThis
discards the\r\n> unused portions of core, before adding them to the
context value, but\r\nstill allow people to pass the entire construct if
we were to need\r\nsomething else\r\n\r\ncc @clintandrewhall
\r\n\r\n----\r\n\r\n### Checklist\r\n\r\nCheck the PR satisfies
following conditions. \r\n\r\nReviewers should verify this PR satisfies
this list as well.\r\n\r\n**none**\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**none**\r\n\r\n---------\r\n\r\nCo-authored-by:
kibanamachine
<[email protected]>","sha":"79e731685ad4af8cabd4c6eb13aa70a6c23d556e"}},"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/203303","number":203303,"mergeCommit":{"message":"[KibanaRootContextProvider]
destructure the params to KibanaEuiProvider (elastic#203303)\n\n##
Summary\r\n\r\nAddresses:\r\nhttps://github.com/elastic/pull/202606#discussion_r1871947907\r\n\r\nThis
discards the\r\n> unused portions of core, before adding them to the
context value, but\r\nstill allow people to pass the entire construct if
we were to need\r\nsomething else\r\n\r\ncc @clintandrewhall
\r\n\r\n----\r\n\r\n### Checklist\r\n\r\nCheck the PR satisfies
following conditions. \r\n\r\nReviewers should verify this PR satisfies
this list as well.\r\n\r\n**none**\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**none**\r\n\r\n---------\r\n\r\nCo-authored-by:
kibanamachine
<[email protected]>","sha":"79e731685ad4af8cabd4c6eb13aa70a6c23d556e"}}]}]
BACKPORT-->

Co-authored-by: Tim Sullivan <[email protected]>
  • Loading branch information
kibanamachine and tsullivan authored Dec 11, 2024
1 parent 82d1f7a commit d624dd4
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 10 deletions.
8 changes: 6 additions & 2 deletions packages/react/kibana_context/render/render_provider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,13 @@ export type KibanaRenderContextProviderProps = Omit<KibanaRootContextProviderPro
export const KibanaRenderContextProvider: FC<
PropsWithChildren<KibanaRenderContextProviderProps>
> = ({ children, ...props }) => {
const { analytics, i18n, theme, userProfile, colorMode, modify } = props;
return (
<KibanaRootContextProvider globalStyles={false} {...props}>
<KibanaErrorBoundaryProvider analytics={props.analytics}>
<KibanaRootContextProvider
globalStyles={false}
{...{ i18n, theme, userProfile, modify, colorMode }}
>
<KibanaErrorBoundaryProvider analytics={analytics}>
<KibanaErrorBoundary>{children}</KibanaErrorBoundary>
</KibanaErrorBoundaryProvider>
</KibanaRootContextProvider>
Expand Down
6 changes: 0 additions & 6 deletions packages/react/kibana_context/root/root_provider.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ import { useEuiTheme } from '@elastic/eui';
import type { UseEuiTheme } from '@elastic/eui';
import { mountWithIntl } from '@kbn/test-jest-helpers';
import type { KibanaTheme } from '@kbn/react-kibana-context-common';
import type { AnalyticsServiceStart } from '@kbn/core-analytics-browser';
import { analyticsServiceMock } from '@kbn/core-analytics-browser-mocks';
import { i18nServiceMock } from '@kbn/core-i18n-browser-mocks';
import { I18nStart } from '@kbn/core-i18n-browser';
import type { UserProfileService } from '@kbn/core-user-profile-browser';
Expand All @@ -26,12 +24,10 @@ import { KibanaRootContextProvider } from './root_provider';
describe('KibanaRootContextProvider', () => {
let euiTheme: UseEuiTheme | undefined;
let i18nMock: I18nStart;
let analytics: AnalyticsServiceStart;
let userProfile: UserProfileService;

beforeEach(() => {
euiTheme = undefined;
analytics = analyticsServiceMock.createAnalyticsServiceStart();
i18nMock = i18nServiceMock.createStartContract();
userProfile = userProfileServiceMock.createStart();
});
Expand Down Expand Up @@ -66,7 +62,6 @@ describe('KibanaRootContextProvider', () => {

const wrapper = mountWithIntl(
<KibanaRootContextProvider
analytics={analytics}
i18n={i18nMock}
userProfile={userProfile}
theme={{ theme$: of(coreTheme) }}
Expand All @@ -85,7 +80,6 @@ describe('KibanaRootContextProvider', () => {

const wrapper = mountWithIntl(
<KibanaRootContextProvider
analytics={analytics}
i18n={i18nMock}
userProfile={userProfile}
theme={{ theme$: coreTheme$ }}
Expand Down
3 changes: 2 additions & 1 deletion packages/react/kibana_context/root/root_provider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,9 @@ export const KibanaRootContextProvider: FC<PropsWithChildren<KibanaRootContextPr
);
return <i18n.Context>{children}</i18n.Context>;
} else {
const { theme, userProfile, globalStyles, colorMode, modify } = props;
return (
<KibanaEuiProvider {...props}>
<KibanaEuiProvider {...{ theme, userProfile, globalStyles, colorMode, modify }}>
<i18n.Context>{children}</i18n.Context>
</KibanaEuiProvider>
);
Expand Down
1 change: 0 additions & 1 deletion packages/react/kibana_context/root/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
"@kbn/core-i18n-browser",
"@kbn/core-base-common",
"@kbn/core-analytics-browser",
"@kbn/core-analytics-browser-mocks",
"@kbn/core-user-profile-browser",
"@kbn/core-user-profile-browser-mocks",
]
Expand Down

0 comments on commit d624dd4

Please sign in to comment.