badges: use useAsyncEntity

Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
This commit is contained in:
Patrik Oldsberg
2022-03-16 15:52:02 +01:00
parent c484c4825f
commit 5f7d1e303d
2 changed files with 7 additions and 2 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/plugin-badges': patch
---
Fixed an error caused by the `EntityBadgesDialog` trying to access the entity before it is loaded.
@@ -14,7 +14,7 @@
* limitations under the License.
*/
import { useEntity } from '@backstage/plugin-catalog-react';
import { useAsyncEntity } from '@backstage/plugin-catalog-react';
import {
Box,
Button,
@@ -44,7 +44,7 @@ type Props = {
export const EntityBadgesDialog = ({ open, onClose }: Props) => {
const theme = useTheme();
const { entity } = useEntity();
const { entity } = useAsyncEntity();
const fullScreen = useMediaQuery(theme.breakpoints.down('sm'));
const badgesApi = useApi(badgesApiRef);