Skip to content

fix: notification type not correctly rendered in antd and mantine providers - #7486

Open
Narasimha2211 wants to merge 1 commit into
refinedev:mainfrom
Narasimha2211:fix/notification-type-rendering
Open

fix: notification type not correctly rendered in antd and mantine providers#7486
Narasimha2211 wants to merge 1 commit into
refinedev:mainfrom
Narasimha2211:fix/notification-type-rendering

Conversation

@Narasimha2211

Copy link
Copy Markdown

Summary

  • @refinedev/antd: notificationProvider now calls the notification.success / notification.error / notification.info / notification.warning shortcut methods instead of passing an unsupported type option to notification.open(). antd's open() has no type option, so it was silently dropped and every non-progress notification rendered with no icon/color.
  • @refinedev/mantine: notificationProvider now maps each notification type to its own color and icon (via a notificationStyleByType map) instead of color: type === "success" ? "primary" : "red", which collapsed every non-"success" type into the same red/error styling.
  • @refinedev/core: widened OpenNotificationParams.type to "success" | "error" | "progress" | "info" | "warning" and made it optional, so a plain/neutral notification can be rendered without a @ts-expect-error workaround.

@refinedev/mui and @refinedev/chakra-ui were checked as well — both already forward type directly into notistack's variant / Chakra's status, both of which already support "info" and "warning" and treat undefined as a neutral default, so no changes were needed there.

Fixes #7477
Resolves #6326

Test plan

  • Updated packages/antd/src/providers/notificationProvider/index.spec.tsx to assert notification.success / .error / .info / .warning / .open (fallback) are called correctly, for both the App.useApp() context path and the static notification singleton path.
  • pnpm --filter @refinedev/core --filter @refinedev/antd --filter @refinedev/mantine test -- --run — all suites pass (core: 1213/1213, antd: 478 passed/2 skipped, mantine: 354 passed/2 skipped).
  • pnpm --filter "@refinedev/core..." --filter "@refinedev/antd..." --filter "@refinedev/mantine..." build — builds and declaration generation succeed with no type errors.
  • Added a changeset (patch bump for @refinedev/core, @refinedev/antd, @refinedev/mantine).

🤖 Generated with Claude Code

…viders

- @refinedev/antd: use notification.success/error/info/warning shortcut
  methods instead of passing an unsupported `type` option to
  notification.open(), which silently dropped icon/color styling.
- @refinedev/mantine: map each notification type to its own color/icon
  instead of collapsing every non-"success" type into red/error styling.
- @refinedev/core: widen OpenNotificationParams.type to include
  "info" | "warning" and make it optional, so a neutral notification can
  be shown without a @ts-expect-error workaround (resolves refinedev#6326).

Resolves refinedev#7477

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings July 16, 2026 10:20
@changeset-bot

changeset-bot Bot commented Jul 16, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 4c717b1

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 3 packages
Name Type
@refinedev/core Patch
@refinedev/antd Patch
@refinedev/mantine Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes incorrect rendering of notification “type” across UI providers by aligning each provider’s API usage with what the underlying UI library actually supports, and broadens the core notification type definition to allow info/warning and an optional (neutral) type.

Changes:

  • @refinedev/antd: route success/error/info/warning through the corresponding notification.* shortcut methods, falling back to notification.open when type is absent/unsupported.
  • @refinedev/mantine: map notification type to distinct color + icon via a centralized notificationStyleByType map.
  • @refinedev/core: widen OpenNotificationParams.type to include info/warning and make it optional.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
packages/mantine/src/providers/notificationProvider.tsx Adds a type→(color, icon) map for Mantine notifications to avoid collapsing types into a single style.
packages/core/src/contexts/notification/types.ts Expands and optionalizes the notification type union.
packages/antd/src/providers/notificationProvider/index.tsx Uses antd notification.success/error/info/warning shortcuts instead of unsupported type on open().
packages/antd/src/providers/notificationProvider/index.spec.tsx Updates tests to assert correct antd notification method selection (static path covered more fully than App context path).
.changeset/wet-donkeys-repair.md Adds a changeset for patch releases across affected packages.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 166 to 171
const openFn = vi.fn();
const successFn = vi.fn();
const errorFn = vi.fn();
const infoFn = vi.fn();
const warningFn = vi.fn();
const destroyFn = vi.fn();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] notification type is not respected in @refinedev/antd and @refinedev/mantine [FEAT] Notification types

2 participants