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

Make PromiseData partial in toast.promise #160

Closed
ajmnz opened this issue Oct 3, 2023 · 2 comments Β· Fixed by #164
Closed

Make PromiseData partial in toast.promise #160

ajmnz opened this issue Oct 3, 2023 · 2 comments Β· Fixed by #164

Comments

@ajmnz
Copy link
Contributor

ajmnz commented Oct 3, 2023

πŸ‘‹

We use Sonner together with React Query. Our queryClient automatically shows an error toast when a request fails (and some other cond. are met). When making mutations, we use toast.promise to show the loading and success states β€” since errors are handled elsewhere, we don't even bother.

What I'm proposing is changing PromiseData

<ToastData>(promise: PromiseT<ToastData>, data?: PromiseData<ToastData>) => string | number;

To the following:

<ToastData>(promise: PromiseT<ToastData>, data?: Partial<PromiseData<ToastData>>) => string | number;

This would not only make error optional, but all the other properties too.

I'm open to make a PR if needed. Thank you!

@emilkowalski
Copy link
Owner

Sounds good, feel free to post a PR!

@iambpn
Copy link

iambpn commented Oct 4, 2023

Seems easy. Is this PR already assigned by anybody? If not, can you assign this to me?

First time trying to submit a PR so little guidance would be great.

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 a pull request may close this issue.

3 participants