Skip to content

Comments

Replace custom toasts with sonner#6207

Merged
mirekm merged 99 commits intomainfrom
sonner-not-soon-enough
Jan 21, 2026
Merged

Replace custom toasts with sonner#6207
mirekm merged 99 commits intomainfrom
sonner-not-soon-enough

Conversation

@mirekm
Copy link
Member

@mirekm mirekm commented Dec 15, 2025

Scope

  • Replaces Saleor Dashboard toasts design and behaviour globally
  • Drops previous apiMessage handling via See more (we have to improve the error massages, as logs are not helping any of the Dashboard users)
  • Falls back to apiMessage if there's no description
  • Respects Saleor's Dark and Light themes

mirekm added 30 commits December 5, 2025 18:38
When no products are available in the channel or channel is inactive.
- Create new OrderCaptureDialog component using macaw-ui-next
- Supports three capture options: order total, authorized amount, custom
- Shows contextual warnings when authorized differs from total
- Integrate with both Legacy Payments API and Transactions API flows
- Include development overrides for testing (to be removed)
@mirekm mirekm marked this pull request as ready for review December 26, 2025 13:05
Base automatically changed from enable-granular-capture to main January 14, 2026 16:44
Copilot AI review requested due to automatic review settings January 20, 2026 13:52
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 177 out of 178 changed files in this pull request and generated 3 comments.

Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported

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


// Assert
expect(result.current).toBeTruthy();
expect(typeof result.current?.show).toBe("function");
Copy link

Copilot AI Jan 20, 2026

Choose a reason for hiding this comment

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

The NotificationProvider test expects a 'show' method on the context, but the actual NotificationContext interface only provides 'remove' and 'clearErrorNotifications' methods. The notification functionality is now accessed through the useNotifier hook directly, not through the context. This test assertion is incorrect and should be removed.

Copilot uses AI. Check for mistakes.
Comment on lines 296 to 305
// Also check for Apollo errors (network errors, GraphQL execution errors)
// These are stored in opts.error, not in the mutation response data
const hasApolloError = !!opts.error;

return getMutationState(
opts.called,
opts.loading,
errors,
hasApolloError ? [{ error: opts.error }] : [],
);
Copy link

Copilot AI Jan 20, 2026

Choose a reason for hiding this comment

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

The getMutationStatus function is checking for Apollo errors and adding them to an array, but the array structure ({ error: opts.error }) doesn't match the expected error type for getMutationState. This could cause type errors or unexpected behavior in error handling. Consider verifying that getMutationState can handle Apollo errors properly or restructure how these errors are passed.

Copilot uses AI. Check for mistakes.
Comment on lines 3 to 4
// Re-export common messages for backward compatibility
export const calloutTitleMessages = {
Copy link

Copilot AI Jan 20, 2026

Choose a reason for hiding this comment

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

The calloutTitleMessages object is now referencing commonMessages for backward compatibility, but this creates a dependency structure where Callout messages import from intl. If commonMessages.info or commonMessages.warning are ever removed or renamed, this will break silently. Consider adding a comment or explicit type check to ensure these dependencies remain stable, or update all consumers to use commonMessages directly.

Suggested change
// Re-export common messages for backward compatibility
export const calloutTitleMessages = {
// Re-export common messages for backward compatibility.
// Typed against commonMessages to ensure these keys remain stable.
export const calloutTitleMessages: Pick<typeof commonMessages, "info" | "warning"> = {

Copilot uses AI. Check for mistakes.
Copilot AI review requested due to automatic review settings January 20, 2026 16:12
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 175 out of 176 changed files in this pull request and generated 2 comments.

Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported

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

}}
>
<Text size={2} color="default2">
{isExpanded ? "Show less" : "Show more"}
Copy link

Copilot AI Jan 20, 2026

Choose a reason for hiding this comment

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

The hardcoded text "Show less" and "Show more" should be internationalized using the intl system, similar to how other user-facing text in the dashboard is handled. These strings should be defined in a messages file and formatted using intl.formatMessage().

Copilot uses AI. Check for mistakes.
}

export interface INotificationContext {
remove: (notificationId: number) => void;
Copy link

Copilot AI Jan 20, 2026

Choose a reason for hiding this comment

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

The remove method in INotificationContext only accepts number, but Sonner's toast.dismiss() can receive string | number IDs. The Toast component correctly accepts string | number for its id prop. To maintain type safety and consistency with Sonner's API, update the remove method signature to accept (notificationId: string | number) => void.

Copilot uses AI. Check for mistakes.
lkostrowski
lkostrowski previously approved these changes Jan 21, 2026
Copilot AI review requested due to automatic review settings January 21, 2026 14:35
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

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

Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported

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

@mirekm mirekm merged commit 6b89f21 into main Jan 21, 2026
24 of 25 checks passed
@mirekm mirekm deleted the sonner-not-soon-enough branch January 21, 2026 15:10
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.

3 participants