-
Couldn't load subscription status.
- Fork 58
Changes to toast promise #1455
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
Changes to toast promise #1455
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
great changes!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Take a look at my piggyback PR. If you merge that then this is good to go :) #1460
lib/components/util/toasts.tsx
Outdated
| id?: string, | ||
| silentOnSuccess = false | ||
| ): Promise<any> => { | ||
| if (!promise) return |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is promise optional? Can you mark it as optional in the argument list?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm I dont think this should be optional. This line is here because in the case of rememberPlace, if a user isn't logged in, the promise gets passed into this function as undefined
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If it can be undefined then it should be optional! There should be a type error somewhere else if there's an undefined that gets passed into this function, since undefined is not compatible with Promise. If there's no type error is probably because there's an any type somewhere else that maybe should be fixed as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're right! Reworked this in 1fbe9bd, i really don't think the promise should ever be undefined
…ast-promise remove unneded functions and add generic type
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great to me! Thanks for the improvements!
lib/components/util/toasts.tsx
Outdated
|
|
||
| export const toastPromise = async ( | ||
| promise: Promise<any>, | ||
| export const toastPromise = async <T,>( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cool!
Description:
userSuccessnumber result fromrememberPlaceas it wasn't being used anywhere.PR Checklist: