Skip to content

Commit bebf3b2

Browse files
committed
Rename getSpacesContext to getSpacesContextProvider
1 parent 032b5cb commit bebf3b2

11 files changed

Lines changed: 22 additions & 15 deletions

File tree

src/plugins/saved_objects_management/public/management_section/saved_objects_table_page.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,8 @@ const SavedObjectsTablePage = ({
7474
}, [setBreadcrumbs]);
7575

7676
const ContextWrapper = useMemo(
77-
() => (spacesApi ? spacesApi.ui.components.getSpacesContext : getEmptyFunctionComponent),
77+
() =>
78+
spacesApi ? spacesApi.ui.components.getSpacesContextProvider : getEmptyFunctionComponent,
7879
[spacesApi]
7980
);
8081

src/plugins/spaces_oss/public/api.mock.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ type SpacesApiUiComponentMock = jest.Mocked<SpacesApiUiComponent>;
3232

3333
const createApiUiComponentsMock = () => {
3434
const mock: SpacesApiUiComponentMock = {
35-
getSpacesContext: jest.fn(),
35+
getSpacesContextProvider: jest.fn(),
3636
getShareToSpaceFlyout: jest.fn(),
3737
getSpaceList: jest.fn(),
3838
getLegacyUrlConflict: jest.fn(),

src/plugins/spaces_oss/public/api.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ export interface SpacesApiUiComponent {
6969
/**
7070
* Provides a context that is required to render some Spaces components.
7171
*/
72-
getSpacesContext: LazyComponentFn<SpacesContextProps>;
72+
getSpacesContextProvider: LazyComponentFn<SpacesContextProps>;
7373
/**
7474
* Displays a flyout to edit the spaces that an object is shared to.
7575
*

x-pack/plugins/ml/public/application/management/jobs_list/components/jobs_list_page/jobs_list_page.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,8 @@ export const JobsListPage: FC<{
149149
}, []);
150150

151151
const ContextWrapper = useMemo(
152-
() => (spacesApi ? spacesApi.ui.components.getSpacesContext : getEmptyFunctionComponent),
152+
() =>
153+
spacesApi ? spacesApi.ui.components.getSpacesContextProvider : getEmptyFunctionComponent,
153154
[spacesApi]
154155
);
155156

x-pack/plugins/spaces/public/copy_saved_objects_to_space/components/copy_to_space_flyout_internal.test.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import { findTestSubject, mountWithIntl, nextTick } from '@kbn/test/jest';
1414
import { coreMock } from 'src/core/public/mocks';
1515
import type { Space } from 'src/plugins/spaces_oss/common';
1616

17-
import { getSpacesContextWrapper } from '../../spaces_context';
17+
import { getSpacesContextProviderWrapper } from '../../spaces_context';
1818
import { spacesManagerMock } from '../../spaces_manager/mocks';
1919
import type { SavedObjectTarget } from '../types';
2020
import { CopyModeControl } from './copy_mode_control';
@@ -84,7 +84,7 @@ const setup = async (opts: SetupOpts = {}) => {
8484
title: 'foo',
8585
} as SavedObjectTarget;
8686

87-
const SpacesContext = await getSpacesContextWrapper({
87+
const SpacesContext = await getSpacesContextProviderWrapper({
8888
getStartServices,
8989
spacesManager: mockSpacesManager,
9090
});

x-pack/plugins/spaces/public/share_saved_objects_to_space/components/share_to_space_flyout_internal.test.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import type { Space } from 'src/plugins/spaces_oss/common';
2424

2525
import { ALL_SPACES_ID } from '../../../common/constants';
2626
import { CopyToSpaceFlyoutInternal } from '../../copy_saved_objects_to_space/components/copy_to_space_flyout_internal';
27-
import { getSpacesContextWrapper } from '../../spaces_context';
27+
import { getSpacesContextProviderWrapper } from '../../spaces_context';
2828
import { spacesManagerMock } from '../../spaces_manager/mocks';
2929
import { NoSpacesAvailable } from './no_spaces_available';
3030
import { SelectableSpacesControl } from './selectable_spaces_control';
@@ -103,7 +103,7 @@ const setup = async (opts: SetupOpts = {}) => {
103103
const mockToastNotifications = startServices.notifications.toasts;
104104
getStartServices.mockResolvedValue([startServices, , ,]);
105105

106-
const SpacesContext = await getSpacesContextWrapper({
106+
const SpacesContext = await getSpacesContextProviderWrapper({
107107
getStartServices,
108108
spacesManager: mockSpacesManager,
109109
});

x-pack/plugins/spaces/public/space_list/space_list_internal.test.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import { coreMock } from 'src/core/public/mocks';
1414
import type { Space } from 'src/plugins/spaces_oss/common';
1515
import type { SpaceListProps } from 'src/plugins/spaces_oss/public';
1616

17-
import { getSpacesContextWrapper } from '../spaces_context';
17+
import { getSpacesContextProviderWrapper } from '../spaces_context';
1818
import { spacesManagerMock } from '../spaces_manager/mocks';
1919
import { SpaceListInternal } from './space_list_internal';
2020

@@ -57,7 +57,10 @@ describe('SpaceListInternal', () => {
5757
spacesManager.getActiveSpace.mockResolvedValue(ACTIVE_SPACE);
5858
spacesManager.getSpaces.mockResolvedValue(spaces);
5959

60-
const SpacesContext = await getSpacesContextWrapper({ getStartServices, spacesManager });
60+
const SpacesContext = await getSpacesContextProviderWrapper({
61+
getStartServices,
62+
spacesManager,
63+
});
6164
const wrapper = mountWithIntl(
6265
<SpacesContext feature={feature}>
6366
<SpaceListInternal {...props} />

x-pack/plugins/spaces/public/spaces_context/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@
66
*/
77

88
export { useSpaces } from './context';
9-
export { getSpacesContextWrapper } from './wrapper';
9+
export { getSpacesContextProviderWrapper } from './wrapper';

x-pack/plugins/spaces/public/spaces_context/wrapper.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import type { SpacesContextProps } from 'src/plugins/spaces_oss/public';
1212

1313
import type { InternalProps } from './types';
1414

15-
export const getSpacesContextWrapper = async (
15+
export const getSpacesContextProviderWrapper = async (
1616
internalProps: InternalProps
1717
): Promise<React.FC<SpacesContextProps>> => {
1818
const { SpacesContextWrapperInternal } = await import('./wrapper_internal');

x-pack/plugins/spaces/public/ui_api/components.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import {
1818
} from '../share_saved_objects_to_space';
1919
import { getSpaceAvatarComponent } from '../space_avatar';
2020
import { getSpaceListComponent } from '../space_list';
21-
import { getSpacesContextWrapper } from '../spaces_context';
21+
import { getSpacesContextProviderWrapper } from '../spaces_context';
2222
import type { SpacesManager } from '../spaces_manager';
2323
import { LazyWrapper } from './lazy_wrapper';
2424

@@ -41,7 +41,9 @@ export const getComponents = ({
4141
}
4242

4343
return {
44-
getSpacesContext: wrapLazy(() => getSpacesContextWrapper({ spacesManager, getStartServices })),
44+
getSpacesContextProvider: wrapLazy(() =>
45+
getSpacesContextProviderWrapper({ spacesManager, getStartServices })
46+
),
4547
getShareToSpaceFlyout: wrapLazy(getShareToSpaceFlyoutComponent),
4648
getSpaceList: wrapLazy(getSpaceListComponent),
4749
getLegacyUrlConflict: wrapLazy(() => getLegacyUrlConflict({ getStartServices })),

0 commit comments

Comments
 (0)