From babb280c77ec445fd7376484d69faabb8debbd83 Mon Sep 17 00:00:00 2001 From: blam Date: Tue, 1 Mar 2022 11:27:37 +0100 Subject: [PATCH 1/9] chore: deprecate some of the loading things from useEntity and force entity to be present Signed-off-by: blam --- plugins/catalog-react/src/hooks/index.ts | 3 + plugins/catalog-react/src/hooks/useEntity.tsx | 58 +++++++++++++++---- .../components/EntitySwitch/EntitySwitch.tsx | 7 ++- .../src/components/EntitySwitch/conditions.ts | 6 +- 4 files changed, 58 insertions(+), 16 deletions(-) diff --git a/plugins/catalog-react/src/hooks/index.ts b/plugins/catalog-react/src/hooks/index.ts index 3e6ef7c945..8e0fc48e72 100644 --- a/plugins/catalog-react/src/hooks/index.ts +++ b/plugins/catalog-react/src/hooks/index.ts @@ -18,11 +18,14 @@ export { useEntityFromUrl, EntityProvider, AsyncEntityProvider, + useAsyncEntity, } from './useEntity'; export type { EntityLoadingStatus, EntityProviderProps, AsyncEntityProviderProps, + UseEntityResponse, + UseAsyncEntityResponse, } from './useEntity'; export { useEntityCompoundName } from './useEntityCompoundName'; export { diff --git a/plugins/catalog-react/src/hooks/useEntity.tsx b/plugins/catalog-react/src/hooks/useEntity.tsx index 5cb67cb79a..1db14adc22 100644 --- a/plugins/catalog-react/src/hooks/useEntity.tsx +++ b/plugins/catalog-react/src/hooks/useEntity.tsx @@ -128,26 +128,35 @@ export const useEntityFromUrl = (): EntityLoadingStatus => { return { entity, loading, error, refresh }; }; +export interface UseEntityResponse { + entity: T; + /** @deprecated use useAsyncEntity instead */ + loading: boolean; + /** @deprecated use useAsyncEntity instead */ + error?: Error; + /** @deprecated use useAsyncEntity instead */ + refresh?: VoidFunction; +} + +export interface UseAsyncEntityResponse { + entity?: T; + loading: boolean; + error?: Error; + refresh?: VoidFunction; +} /** - * Grab the current entity from the context and its current loading state. + * Grab the current entity from the context, throws if the entity has not yet been loaded + * or is not available. * * @public */ -export function useEntity() { +export function useEntity(): UseEntityResponse { const versionedHolder = useVersionedContext<{ 1: EntityLoadingStatus }>('entity-context'); if (!versionedHolder) { - // TODO(Rugvip): Throw this once we fully migrate to the new context - // throw new Error('Entity context is not available'); - - return { - entity: undefined as unknown as T, - loading: true, - error: undefined, - refresh: () => {}, - }; + throw new Error('Entity context is not available'); } const value = versionedHolder.atVersion(1); @@ -155,6 +164,33 @@ export function useEntity() { throw new Error('EntityContext v1 not available'); } + if (!value.entity) { + throw new Error('Entity has not been loaded yet'); + } + + const { entity, loading, error, refresh } = value; + return { entity: entity as T, loading, error, refresh }; +} + +/** + * Grab the current entity from the context, provides loading state and errors, and the ability to refresh. + * + * @public + */ +export function useAsyncEntity< + T extends Entity = Entity, +>(): UseAsyncEntityResponse { + const versionedHolder = + useVersionedContext<{ 1: EntityLoadingStatus }>('entity-context'); + + if (!versionedHolder) { + throw new Error('Entity context is not available'); + } + const value = versionedHolder.atVersion(1); + if (!value) { + throw new Error('EntityContext v1 not available'); + } + const { entity, loading, error, refresh } = value; return { entity: entity as T, loading, error, refresh }; } diff --git a/plugins/catalog/src/components/EntitySwitch/EntitySwitch.tsx b/plugins/catalog/src/components/EntitySwitch/EntitySwitch.tsx index 4433517247..1b8667ce2a 100644 --- a/plugins/catalog/src/components/EntitySwitch/EntitySwitch.tsx +++ b/plugins/catalog/src/components/EntitySwitch/EntitySwitch.tsx @@ -15,7 +15,7 @@ */ import { Entity } from '@backstage/catalog-model'; -import { useEntity } from '@backstage/plugin-catalog-react'; +import { useAsyncEntity } from '@backstage/plugin-catalog-react'; import React, { ReactNode, ReactElement } from 'react'; import { attachComponentData, @@ -63,7 +63,7 @@ export interface EntitySwitchProps { /** @public */ export const EntitySwitch = (props: EntitySwitchProps) => { - const { entity } = useEntity(); + const { entity } = useAsyncEntity(); const apis = useApiHolder(); const results = useElementFilter( props.children, @@ -75,6 +75,9 @@ export const EntitySwitch = (props: EntitySwitchProps) => { }) .getElements() .flatMap((element: ReactElement) => { + if (!entity) { + return []; + } const { if: condition, children: elementsChildren } = element.props as EntitySwitchCase; return [ diff --git a/plugins/catalog/src/components/EntitySwitch/conditions.ts b/plugins/catalog/src/components/EntitySwitch/conditions.ts index a02170cc6f..907aa45afe 100644 --- a/plugins/catalog/src/components/EntitySwitch/conditions.ts +++ b/plugins/catalog/src/components/EntitySwitch/conditions.ts @@ -27,7 +27,7 @@ function strCmp(a: string | undefined, b: string | undefined): boolean { * @public */ export function isKind(kind: string) { - return (entity: Entity) => strCmp(entity?.kind, kind); + return (entity: Entity) => strCmp(entity.kind, kind); } /** @@ -36,7 +36,7 @@ export function isKind(kind: string) { */ export function isComponentType(type: string) { return (entity: Entity) => { - if (!strCmp(entity?.kind, 'component')) { + if (!strCmp(entity.kind, 'component')) { return false; } const componentEntity = entity as ComponentEntity; @@ -49,5 +49,5 @@ export function isComponentType(type: string) { * @public */ export function isNamespace(namespace: string) { - return (entity: Entity) => strCmp(entity?.metadata?.namespace, namespace); + return (entity: Entity) => strCmp(entity.metadata?.namespace, namespace); } From 44403296e7c9fff1709548f3bdcff7bd8eceb854 Mon Sep 17 00:00:00 2001 From: blam Date: Tue, 1 Mar 2022 11:39:49 +0100 Subject: [PATCH 2/9] chore: added changeset Signed-off-by: blam --- .changeset/sour-eggs-kick.md | 9 +++++ plugins/catalog-react/api-report.md | 34 ++++++++++++++++--- plugins/catalog-react/src/hooks/useEntity.tsx | 26 +++++++++++--- 3 files changed, 60 insertions(+), 9 deletions(-) create mode 100644 .changeset/sour-eggs-kick.md diff --git a/.changeset/sour-eggs-kick.md b/.changeset/sour-eggs-kick.md new file mode 100644 index 0000000000..6e814415ab --- /dev/null +++ b/.changeset/sour-eggs-kick.md @@ -0,0 +1,9 @@ +--- +'@backstage/plugin-catalog': patch +'@backstage/plugin-catalog-react': patch +--- + +Added the following deprecations to the `catalog-react` package: + +- **DEPRECATION**: `useEntity` will now warn if the entity has not yet been loaded. This hook is now designed only to be used inside of an `EntityPage` where the `entity` prop is guaranteed to be defined. If you would like to use it outside, please use `useAsyncEntity` instead. +- **DEPRECATION**: the `loading`, `error` and `refresh` properties that are returned from `useEntity` have been deprecated, and are available on `useAsyncEntity` instead. diff --git a/plugins/catalog-react/api-report.md b/plugins/catalog-react/api-report.md index e78ec75daa..0103ac2f0e 100644 --- a/plugins/catalog-react/api-report.md +++ b/plugins/catalog-react/api-report.md @@ -524,12 +524,24 @@ export type UnregisterEntityDialogProps = { }; // @public -export function useEntity(): { - entity: T; +export function useAsyncEntity< + T extends Entity = Entity, +>(): UseAsyncEntityResponse; + +// @public +export interface UseAsyncEntityResponse { + // (undocumented) + entity?: T; + // (undocumented) + error?: Error; + // (undocumented) loading: boolean; - error: Error | undefined; - refresh: VoidFunction | undefined; -}; + // (undocumented) + refresh?: VoidFunction; +} + +// @public +export function useEntity(): UseEntityResponse; // @public @deprecated export const useEntityCompoundName: () => { @@ -571,6 +583,18 @@ export function useEntityPermission(permission: Permission): { error?: Error; }; +// @public +export interface UseEntityResponse { + // (undocumented) + entity: T; + // @deprecated (undocumented) + error?: Error; + // @deprecated (undocumented) + loading: boolean; + // @deprecated (undocumented) + refresh?: VoidFunction; +} + // @public export function useEntityTypeFilter(): { loading: boolean; diff --git a/plugins/catalog-react/src/hooks/useEntity.tsx b/plugins/catalog-react/src/hooks/useEntity.tsx index 1db14adc22..9becedfee8 100644 --- a/plugins/catalog-react/src/hooks/useEntity.tsx +++ b/plugins/catalog-react/src/hooks/useEntity.tsx @@ -128,16 +128,27 @@ export const useEntityFromUrl = (): EntityLoadingStatus => { return { entity, loading, error, refresh }; }; + +/** + * @public + * + * The response shape for {@link useEntity} + */ export interface UseEntityResponse { entity: T; - /** @deprecated use useAsyncEntity instead */ + /** @deprecated use {@link useAsyncEntity} instead */ loading: boolean; - /** @deprecated use useAsyncEntity instead */ + /** @deprecated use {@link useAsyncEntity} instead */ error?: Error; - /** @deprecated use useAsyncEntity instead */ + /** @deprecated use {@link useAsyncEntity} instead */ refresh?: VoidFunction; } +/** + * @public + * + * The response shape for {@link useAsyncEntity} + */ export interface UseAsyncEntityResponse { entity?: T; loading: boolean; @@ -165,7 +176,14 @@ export function useEntity(): UseEntityResponse { } if (!value.entity) { - throw new Error('Entity has not been loaded yet'); + // Once we have removed the additional fields from being returned we can drop this deprecation + // and move to the error instead. + // throw new Error('useEntity hook is being called outside of an EntityPage where the entity has not been loaded. If this is intentional, please use useAsyncEntity instead.'); + + // eslint-disable-next-line no-console + console.warn( + 'DEPRECATION: useEntity hook is being called outside of an EntityPage where the entity has not been loaded. If this is intentional, please use useAsyncEntity instead. This warning will be replaced with an error in future releases.', + ); } const { entity, loading, error, refresh } = value; From 6fe5d70cace2d1123c8f3dff3d84fe8b4eb5189a Mon Sep 17 00:00:00 2001 From: blam Date: Tue, 1 Mar 2022 12:49:04 +0100 Subject: [PATCH 3/9] chore: fix up the changeset Signed-off-by: blam --- .changeset/sour-eggs-kick.md | 3 ++- plugins/catalog-react/src/hooks/useEntity.tsx | 2 +- .../catalog/src/components/EntityLayout/EntityLayout.tsx | 8 +++++--- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/.changeset/sour-eggs-kick.md b/.changeset/sour-eggs-kick.md index 6e814415ab..f796b173fb 100644 --- a/.changeset/sour-eggs-kick.md +++ b/.changeset/sour-eggs-kick.md @@ -5,5 +5,6 @@ Added the following deprecations to the `catalog-react` package: -- **DEPRECATION**: `useEntity` will now warn if the entity has not yet been loaded. This hook is now designed only to be used inside of an `EntityPage` where the `entity` prop is guaranteed to be defined. If you would like to use it outside, please use `useAsyncEntity` instead. +- **DEPRECATION**: `useEntity` will now warn if the entity has not yet been loaded, and will soon throw errors instead. If you're using the default implementation of `EntityLayout` and `EntitySwitch` then these components will ensure that there is an entity loaded before rendering children. If you're implementing your own `EntityLayout` or `EntitySwitch` or something that operates outside or adjacent to them, then use `useAsyncEntity`. + - **DEPRECATION**: the `loading`, `error` and `refresh` properties that are returned from `useEntity` have been deprecated, and are available on `useAsyncEntity` instead. diff --git a/plugins/catalog-react/src/hooks/useEntity.tsx b/plugins/catalog-react/src/hooks/useEntity.tsx index 9becedfee8..e46ee680eb 100644 --- a/plugins/catalog-react/src/hooks/useEntity.tsx +++ b/plugins/catalog-react/src/hooks/useEntity.tsx @@ -182,7 +182,7 @@ export function useEntity(): UseEntityResponse { // eslint-disable-next-line no-console console.warn( - 'DEPRECATION: useEntity hook is being called outside of an EntityPage where the entity has not been loaded. If this is intentional, please use useAsyncEntity instead. This warning will be replaced with an error in future releases.', + 'DEPRECATION: useEntity hook is being called outside of an EntityLayout where the entity has not been loaded. If this is intentional, please use useAsyncEntity instead. This warning will be replaced with an error in future releases.', ); } diff --git a/plugins/catalog/src/components/EntityLayout/EntityLayout.tsx b/plugins/catalog/src/components/EntityLayout/EntityLayout.tsx index 634662f386..40c4f9e873 100644 --- a/plugins/catalog/src/components/EntityLayout/EntityLayout.tsx +++ b/plugins/catalog/src/components/EntityLayout/EntityLayout.tsx @@ -40,7 +40,7 @@ import { getEntityRelations, InspectEntityDialog, UnregisterEntityDialog, - useEntity, + useAsyncEntity, useEntityCompoundName, } from '@backstage/plugin-catalog-react'; import { Box, TabProps } from '@material-ui/core'; @@ -177,7 +177,7 @@ export const EntityLayout = (props: EntityLayoutProps) => { children, } = props; const { kind, namespace, name } = useEntityCompoundName(); - const { entity, loading, error } = useEntity(); + const { entity, loading, error } = useAsyncEntity(); const location = useLocation(); const routes = useElementFilter( children, @@ -190,7 +190,9 @@ export const EntityLayout = (props: EntityLayoutProps) => { }) .getElements() // all nodes, element data, maintain structure or not? .flatMap(({ props: elementProps }) => { - if (elementProps.if && entity && !elementProps.if(entity)) { + if (!entity) { + return []; + } else if (elementProps.if && !elementProps.if(entity)) { return []; } From aa69677928adc0467a44b8f47589fec00e898b11 Mon Sep 17 00:00:00 2001 From: blam Date: Tue, 1 Mar 2022 14:03:08 +0100 Subject: [PATCH 4/9] chore: fixing tests Signed-off-by: blam --- .../AllureReportComponent.test.tsx | 11 ++++++++++- plugins/todo/src/plugin.test.tsx | 11 ++++++++++- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/plugins/allure/src/components/AllureReportComponent/AllureReportComponent.test.tsx b/plugins/allure/src/components/AllureReportComponent/AllureReportComponent.test.tsx index 34d12aa032..e6355d861f 100644 --- a/plugins/allure/src/components/AllureReportComponent/AllureReportComponent.test.tsx +++ b/plugins/allure/src/components/AllureReportComponent/AllureReportComponent.test.tsx @@ -23,6 +23,7 @@ import { setupRequestMockHandlers, renderInTestApp, } from '@backstage/test-utils'; +import { EntityProvider } from '@backstage/plugin-catalog-react'; describe('ExampleComponent', () => { const server = setupServer(); @@ -39,7 +40,15 @@ describe('ExampleComponent', () => { it('should render', async () => { const rendered = await renderInTestApp( - + + + , ); expect(rendered.getByText('Missing Annotation')).toBeInTheDocument(); diff --git a/plugins/todo/src/plugin.test.tsx b/plugins/todo/src/plugin.test.tsx index 57b9be291d..847ab7f65c 100644 --- a/plugins/todo/src/plugin.test.tsx +++ b/plugins/todo/src/plugin.test.tsx @@ -19,6 +19,7 @@ import { Route } from 'react-router'; import { renderInTestApp, TestApiProvider } from '@backstage/test-utils'; import { todoPlugin, EntityTodoContent } from './plugin'; import { todoApiRef } from './api'; +import { EntityProvider } from '@backstage/plugin-catalog-react'; describe('todo', () => { it('should export plugin', () => { @@ -47,7 +48,15 @@ describe('todo', () => { ], ]} > - } /> + + } /> + , ); From dd7e34b4b8685389b31c5162dac3f38bc11c8ca8 Mon Sep 17 00:00:00 2001 From: blam Date: Tue, 1 Mar 2022 14:04:15 +0100 Subject: [PATCH 5/9] chore: added additional changeset Signed-off-by: blam --- .changeset/tall-pillows-smash.md | 6 ++++++ plugins/todo/src/plugin.test.tsx | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 .changeset/tall-pillows-smash.md diff --git a/.changeset/tall-pillows-smash.md b/.changeset/tall-pillows-smash.md new file mode 100644 index 0000000000..3c1d18cbe3 --- /dev/null +++ b/.changeset/tall-pillows-smash.md @@ -0,0 +1,6 @@ +--- +'@backstage/plugin-allure': patch +'@backstage/plugin-todo': patch +--- + +Fixing broken tests for the packages with the new `useEntity` change diff --git a/plugins/todo/src/plugin.test.tsx b/plugins/todo/src/plugin.test.tsx index 847ab7f65c..af4704c16f 100644 --- a/plugins/todo/src/plugin.test.tsx +++ b/plugins/todo/src/plugin.test.tsx @@ -50,7 +50,7 @@ describe('todo', () => { > Date: Tue, 1 Mar 2022 15:32:04 +0100 Subject: [PATCH 6/9] chore: fix up the interface a little bit Signed-off-by: blam --- plugins/catalog-react/src/hooks/useEntity.tsx | 51 ++++++------------- 1 file changed, 16 insertions(+), 35 deletions(-) diff --git a/plugins/catalog-react/src/hooks/useEntity.tsx b/plugins/catalog-react/src/hooks/useEntity.tsx index e46ee680eb..8ff5df9349 100644 --- a/plugins/catalog-react/src/hooks/useEntity.tsx +++ b/plugins/catalog-react/src/hooks/useEntity.tsx @@ -27,8 +27,8 @@ import { catalogApiRef } from '../api'; import { useEntityCompoundName } from './useEntityCompoundName'; /** @public */ -export type EntityLoadingStatus = { - entity?: Entity; +export type EntityLoadingStatus = { + entity?: TEntity; loading: boolean; error?: Error; refresh?: VoidFunction; @@ -129,40 +129,21 @@ export const useEntityFromUrl = (): EntityLoadingStatus => { return { entity, loading, error, refresh }; }; -/** - * @public - * - * The response shape for {@link useEntity} - */ -export interface UseEntityResponse { - entity: T; - /** @deprecated use {@link useAsyncEntity} instead */ - loading: boolean; - /** @deprecated use {@link useAsyncEntity} instead */ - error?: Error; - /** @deprecated use {@link useAsyncEntity} instead */ - refresh?: VoidFunction; -} - -/** - * @public - * - * The response shape for {@link useAsyncEntity} - */ -export interface UseAsyncEntityResponse { - entity?: T; - loading: boolean; - error?: Error; - refresh?: VoidFunction; -} - /** * Grab the current entity from the context, throws if the entity has not yet been loaded * or is not available. * * @public */ -export function useEntity(): UseEntityResponse { +export function useEntity(): { + entity: TEntity; + /** @deprecated use {@link useAsyncEntity} instead */ + loading: boolean; + /** @deprecated use {@link useAsyncEntity} instead */ + error?: Error; + /** @deprecated use {@link useAsyncEntity} instead */ + refresh?: VoidFunction; +} { const versionedHolder = useVersionedContext<{ 1: EntityLoadingStatus }>('entity-context'); @@ -178,7 +159,7 @@ export function useEntity(): UseEntityResponse { if (!value.entity) { // Once we have removed the additional fields from being returned we can drop this deprecation // and move to the error instead. - // throw new Error('useEntity hook is being called outside of an EntityPage where the entity has not been loaded. If this is intentional, please use useAsyncEntity instead.'); + // throw new Error('useEntity hook is being called outside of an EntityLayout where the entity has not been loaded. If this is intentional, please use useAsyncEntity instead.'); // eslint-disable-next-line no-console console.warn( @@ -187,7 +168,7 @@ export function useEntity(): UseEntityResponse { } const { entity, loading, error, refresh } = value; - return { entity: entity as T, loading, error, refresh }; + return { entity: entity as TEntity, loading, error, refresh }; } /** @@ -196,8 +177,8 @@ export function useEntity(): UseEntityResponse { * @public */ export function useAsyncEntity< - T extends Entity = Entity, ->(): UseAsyncEntityResponse { + TEntity extends Entity = Entity, +>(): EntityLoadingStatus { const versionedHolder = useVersionedContext<{ 1: EntityLoadingStatus }>('entity-context'); @@ -210,5 +191,5 @@ export function useAsyncEntity< } const { entity, loading, error, refresh } = value; - return { entity: entity as T, loading, error, refresh }; + return { entity: entity as TEntity, loading, error, refresh }; } From 141af65385d3b6c0bea94f6c29ee4ab2f22e7baf Mon Sep 17 00:00:00 2001 From: blam Date: Tue, 1 Mar 2022 15:34:47 +0100 Subject: [PATCH 7/9] chore: fixing the api-report and clean up the types Signed-off-by: blam --- plugins/catalog-react/api-report.md | 35 +++++-------------- plugins/catalog-react/src/hooks/index.ts | 2 -- plugins/catalog-react/src/hooks/useEntity.tsx | 2 +- 3 files changed, 9 insertions(+), 30 deletions(-) diff --git a/plugins/catalog-react/api-report.md b/plugins/catalog-react/api-report.md index 0103ac2f0e..1a94af6052 100644 --- a/plugins/catalog-react/api-report.md +++ b/plugins/catalog-react/api-report.md @@ -225,8 +225,8 @@ export const EntityListProvider: ({ }: PropsWithChildren<{}>) => JSX.Element; // @public (undocumented) -export type EntityLoadingStatus = { - entity?: Entity; +export type EntityLoadingStatus = { + entity?: TEntity; loading: boolean; error?: Error; refresh?: VoidFunction; @@ -525,23 +525,16 @@ export type UnregisterEntityDialogProps = { // @public export function useAsyncEntity< - T extends Entity = Entity, ->(): UseAsyncEntityResponse; + TEntity extends Entity = Entity, +>(): EntityLoadingStatus; // @public -export interface UseAsyncEntityResponse { - // (undocumented) - entity?: T; - // (undocumented) - error?: Error; - // (undocumented) +export function useEntity(): { + entity: TEntity; loading: boolean; - // (undocumented) + error?: Error; refresh?: VoidFunction; -} - -// @public -export function useEntity(): UseEntityResponse; +}; // @public @deprecated export const useEntityCompoundName: () => { @@ -583,18 +576,6 @@ export function useEntityPermission(permission: Permission): { error?: Error; }; -// @public -export interface UseEntityResponse { - // (undocumented) - entity: T; - // @deprecated (undocumented) - error?: Error; - // @deprecated (undocumented) - loading: boolean; - // @deprecated (undocumented) - refresh?: VoidFunction; -} - // @public export function useEntityTypeFilter(): { loading: boolean; diff --git a/plugins/catalog-react/src/hooks/index.ts b/plugins/catalog-react/src/hooks/index.ts index 8e0fc48e72..da23d54ad7 100644 --- a/plugins/catalog-react/src/hooks/index.ts +++ b/plugins/catalog-react/src/hooks/index.ts @@ -24,8 +24,6 @@ export type { EntityLoadingStatus, EntityProviderProps, AsyncEntityProviderProps, - UseEntityResponse, - UseAsyncEntityResponse, } from './useEntity'; export { useEntityCompoundName } from './useEntityCompoundName'; export { diff --git a/plugins/catalog-react/src/hooks/useEntity.tsx b/plugins/catalog-react/src/hooks/useEntity.tsx index 8ff5df9349..f70adef708 100644 --- a/plugins/catalog-react/src/hooks/useEntity.tsx +++ b/plugins/catalog-react/src/hooks/useEntity.tsx @@ -27,7 +27,7 @@ import { catalogApiRef } from '../api'; import { useEntityCompoundName } from './useEntityCompoundName'; /** @public */ -export type EntityLoadingStatus = { +export type EntityLoadingStatus = { entity?: TEntity; loading: boolean; error?: Error; From fd061e47ee35fe54000d7e6b31d5fa47f76ec034 Mon Sep 17 00:00:00 2001 From: blam Date: Wed, 2 Mar 2022 10:38:10 +0100 Subject: [PATCH 8/9] chore: code review comments Signed-off-by: blam --- .changeset/tall-pillows-smash.md | 6 ------ plugins/catalog-react/src/hooks/useEntity.tsx | 2 +- 2 files changed, 1 insertion(+), 7 deletions(-) delete mode 100644 .changeset/tall-pillows-smash.md diff --git a/.changeset/tall-pillows-smash.md b/.changeset/tall-pillows-smash.md deleted file mode 100644 index 3c1d18cbe3..0000000000 --- a/.changeset/tall-pillows-smash.md +++ /dev/null @@ -1,6 +0,0 @@ ---- -'@backstage/plugin-allure': patch -'@backstage/plugin-todo': patch ---- - -Fixing broken tests for the packages with the new `useEntity` change diff --git a/plugins/catalog-react/src/hooks/useEntity.tsx b/plugins/catalog-react/src/hooks/useEntity.tsx index f70adef708..da3fb8f3a5 100644 --- a/plugins/catalog-react/src/hooks/useEntity.tsx +++ b/plugins/catalog-react/src/hooks/useEntity.tsx @@ -178,7 +178,7 @@ export function useEntity(): { */ export function useAsyncEntity< TEntity extends Entity = Entity, ->(): EntityLoadingStatus { +>(): EntityLoadingStatus { const versionedHolder = useVersionedContext<{ 1: EntityLoadingStatus }>('entity-context'); From 6ed51204ff27d95cdbbac9862ad5a959aa2a1207 Mon Sep 17 00:00:00 2001 From: blam Date: Wed, 2 Mar 2022 11:32:45 +0100 Subject: [PATCH 9/9] chore: woops - api-report needed update Signed-off-by: blam --- plugins/catalog-react/api-report.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/catalog-react/api-report.md b/plugins/catalog-react/api-report.md index 1a94af6052..b660ceadb5 100644 --- a/plugins/catalog-react/api-report.md +++ b/plugins/catalog-react/api-report.md @@ -526,7 +526,7 @@ export type UnregisterEntityDialogProps = { // @public export function useAsyncEntity< TEntity extends Entity = Entity, ->(): EntityLoadingStatus; +>(): EntityLoadingStatus; // @public export function useEntity(): {