fix: notification type not correctly rendered in antd and mantine providers - #7486
Open
Narasimha2211 wants to merge 1 commit into
Open
fix: notification type not correctly rendered in antd and mantine providers#7486Narasimha2211 wants to merge 1 commit into
Narasimha2211 wants to merge 1 commit into
Conversation
…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>
🦋 Changeset detectedLatest commit: 4c717b1 The changes in this PR will be included in the next version bump. This PR includes changesets to release 3 packages
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 |
There was a problem hiding this comment.
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/warningthrough the correspondingnotification.*shortcut methods, falling back tonotification.openwhentypeis absent/unsupported. - @refinedev/mantine: map notification
typeto distinct color + icon via a centralizednotificationStyleByTypemap. - @refinedev/core: widen
OpenNotificationParams.typeto includeinfo/warningand 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(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
@refinedev/antd:notificationProvidernow calls thenotification.success/notification.error/notification.info/notification.warningshortcut methods instead of passing an unsupportedtypeoption tonotification.open(). antd'sopen()has notypeoption, so it was silently dropped and every non-progress notification rendered with no icon/color.@refinedev/mantine:notificationProvidernow maps each notificationtypeto its own color and icon (via anotificationStyleByTypemap) instead ofcolor: type === "success" ? "primary" : "red", which collapsed every non-"success"type into the same red/error styling.@refinedev/core: widenedOpenNotificationParams.typeto"success" | "error" | "progress" | "info" | "warning"and made it optional, so a plain/neutral notification can be rendered without a@ts-expect-errorworkaround.@refinedev/muiand@refinedev/chakra-uiwere checked as well — both already forwardtypedirectly into notistack'svariant/ Chakra'sstatus, both of which already support"info"and"warning"and treatundefinedas a neutral default, so no changes were needed there.Fixes #7477
Resolves #6326
Test plan
packages/antd/src/providers/notificationProvider/index.spec.tsxto assertnotification.success/.error/.info/.warning/.open(fallback) are called correctly, for both theApp.useApp()context path and the staticnotificationsingleton 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.@refinedev/core,@refinedev/antd,@refinedev/mantine).🤖 Generated with Claude Code