-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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 showModal to avoid having catch everywhere #4566
Comments
@kravets-levko here's another suggestion: When the dialog is closed or dismissed always call resolve the promise, but resolve it with values that represent whether it was dismissed and what the result was. Is this possible? |
Yes, sure - it's actually option 4 from my list. Also I posted one more comment in that thread:
|
I don't think the last suggestion is a good one. There just shouldn't be an error when there isn't one :) |
Rejected promise is not an error, actually. I like current flow because it clearly describes two paths - when used accepted some action (then dialog is "resolved"), and when cancelled (then dialog is "rejected"). So when you need to handle only success path - you don't have to add any |
We could avoid using promises here and just pass a callback for dialog closed and another (optional) for dialog cancelled. This way handler stays the same and we don't have to abuse a promise. |
(follow up to this conversation)
redash/client/app/components/tags-control/TagsControl.jsx
Lines 27 to 30 in 2755e12
@arikfr:
@kravets-levko
The text was updated successfully, but these errors were encountered: