chore: fix up the changeset

Signed-off-by: blam <ben@blam.sh>
This commit is contained in:
blam
2022-03-01 12:49:04 +01:00
parent 44403296e7
commit 6fe5d70cac
3 changed files with 8 additions and 5 deletions
@@ -182,7 +182,7 @@ export function useEntity<T extends Entity = Entity>(): UseEntityResponse<T> {
// 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.',
);
}
@@ -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<EntityLayoutRouteProps>() // 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 [];
}