Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(Toaster): fix incompatibility of different Toaster APIs #1987

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

icekimi23
Copy link
Contributor

PR is made to implement this RFC gravity-ui/rfc#15

@gravity-ui-bot
Copy link
Contributor

Preview is ready.

@gravity-ui-bot
Copy link
Contributor

Visual Tests Report is ready.

remove(name: string) {
this.toasts = removeToast(this.toasts, name);

this.notify();
}
Copy link
Contributor

@ogonkov ogonkov Dec 17, 2024

Choose a reason for hiding this comment

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

I think we need to maintain destroy() method, let it call removeAll underneath


import {ToasterContext} from './ToasterContext';
import {ToastsContext} from './ToastsContext';

type Props = React.PropsWithChildren<{}>;
type Props = React.PropsWithChildren<{
toaster: ToasterSingleton;
Copy link
Contributor

Choose a reason for hiding this comment

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

This is definitely breaking change, please change target branch to next

Comment on lines +94 to 98
private notify() {
for (const listener of this.listeners) {
listener(this.toasts);
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Please separate subscribe pattern from Toaster class to separate base class EventEmitter

@ogonkov
Copy link
Contributor

ogonkov commented Dec 17, 2024

Please describe all breaking changes in PR description

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