deps: migrate fec/notifications

The frontend component library decoupled notifications from redux.
Dispatching notifications via the notifications middleware was replaced
by a new `useAddNotifications` hook.

We mostly used the notifications middleware outside of React Components
in our `enhancedImageBuilderApi` store for mutation events. I created a
wrapper around the RTK hooks that uses the `useAddNotification` hook
and created a directory for the new hooks.

In other places, where we were using the notification dispatcher inside
React components, I replaced the call with the new hook.

[1] b1d4973144/packages/notifications/doc/migration.md

bump @redhat-cloud-services/frontend-components-notifications

---
updated-dependencies:
- dependency-name: "@redhat-cloud-services/frontend-components-notifications"
  dependency-version: 6.0.2
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Co-authored-by: dependabot[bot] <support@github.com>
Assisted-by: cursor ide for generalizing the `useMutationWithNotification`
hook.
This commit is contained in:
Gianluca Zuccarelli 2025-06-24 16:45:14 +01:00 committed by Klara Simickova
parent 77e0f5d6bf
commit e8d46dd716
32 changed files with 412 additions and 473 deletions

View file

@ -13,6 +13,7 @@ import {
Title,
} from '@patternfly/react-core';
import { useFixupBPWithNotification as useFixupBlueprintMutation } from '../../Hooks';
import {
useGetBlueprintsQuery,
useGetBlueprintQuery,
@ -28,7 +29,6 @@ import {
useGetBlueprintComposesQuery,
Distributions,
GetBlueprintComposesApiArg,
useFixupBlueprintMutation,
} from '../../store/imageBuilderApi';
import { BlueprintActionsMenu } from '../Blueprints/BlueprintActionsMenu';
import BlueprintDiffModal from '../Blueprints/BlueprintDiffModal';
@ -128,7 +128,7 @@ const ImagesTableToolbar: React.FC<imagesTableToolbarProps> = ({
{ skip: !selectedBlueprintId }
);
const [fixupBlueprint] = useFixupBlueprintMutation();
const { trigger: fixupBlueprint } = useFixupBlueprintMutation();
const hasErrors =
blueprintDetails?.lint?.errors && blueprintDetails?.lint?.errors.length > 0;
const [isLintExp, setIsLintExp] = React.useState(true);