Skip to content

feat: Implement support for multiple toaster on a page#27831

Merged
ling1726 merged 3 commits into
microsoft:masterfrom
ling1726:react-toast/feat/toaster-id
May 15, 2023
Merged

feat: Implement support for multiple toaster on a page#27831
ling1726 merged 3 commits into
microsoft:masterfrom
ling1726:react-toast/feat/toaster-id

Conversation

@ling1726

@ling1726 ling1726 commented May 12, 2023

Copy link
Copy Markdown
Contributor

Adds the toasterId prop to all Toaster components and controllers. If a Toaster has the toasterId prop set, then it will ignore any toast events except those with its id.

This change required splitting up the dismissing functionalities into:

  • dismissToast - for single toasts
  • dismissAllToasts - to dismiss all toasts

Addresses #27827

ling1726 added 2 commits May 12, 2023 14:31
Adds the `toasterId` prop to all Toaster components and controllers. If
a Toaster has the `toasterId` prop set, then it will ignore any toast
events except those with its id.
@ling1726
ling1726 marked this pull request as ready for review May 12, 2023 14:48
@ling1726
ling1726 requested a review from a team as a code owner May 12, 2023 14:48
@github-actions github-actions Bot added this to the May Project Cycle Q2 2023 milestone May 12, 2023
Comment thread packages/react-components/react-toast/src/state/vanilla/toaster.ts
@fabricteam

fabricteam commented May 12, 2023

Copy link
Copy Markdown
Collaborator

📊 Bundle size report

🤖 This report was generated against adb50a1f3d4d2843943bc0917979050d7925792c

@size-auditor

size-auditor Bot commented May 12, 2023

Copy link
Copy Markdown

Asset size changes

Size Auditor did not detect a change in bundle size for any component!

Baseline commit: f44600a9b36abdd6aed4aaa8e44afdf049f8870f (build)

@codesandbox-ci

codesandbox-ci Bot commented May 12, 2023

Copy link
Copy Markdown

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit 5cdb457:

Sandbox Source
@fluentui/react 8 starter Configuration
@fluentui/react-components 9 starter Configuration

Comment thread packages/react-components/react-toast/src/state/vanilla/toaster.ts
Comment thread packages/react-components/react-toast/src/state/vanilla/toaster.ts
@ling1726
ling1726 enabled auto-merge (squash) May 15, 2023 14:55
@ling1726
ling1726 merged commit 2cefd95 into microsoft:master May 15, 2023
return (
<>
<Toaster />
<Toaster toasterId={toasterId} />

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Is usage of toasterId mandatory? If no, why all examples were updated?

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.

5 participants