You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm using the ConfirmationDialog component, and I think the default experience with asynchronous accept callbacks could be improved.
Currently, the accept callback is not able to be asynchronous. That is, as soon as the accept callback is run, the dialog closes. I am not able to await the API call.
asyncfunctiondeleteRow(data: IRow){awaitfetch(...)}functiononDelete(data: IRow){confirm.require({header: 'Delete?',message: `Are you sure you want to delete ${data}?`,rejectLabel: 'Cancel',acceptLabel: 'Delete',acceptProps: {outlined: true,severity: 'error',},position: 'right',accept: async()=>awaitdeleteMyRow(data),})}
Currently this results in the following experience:
I press confirm on the confirmation dialog.
The dialog closes.
Some time passes...
The API call resolves.
Ideally:
I press confirm on the confirmation dialog.
The API call resolves (await the accept callback).
i. Maybe during this time, the dialog cannot be closed, the 'cancel' button is disabled, and the 'accept' button is loading?
The dialog closes.
Here is a crude implementation of these changes. If there is some positive feedback here, and this feature could be implemented, I'd be happy to expand this to cover other similar components, e.g. ConfirmationPopup: joemaylor/primevue@7ccfe52
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I'm using the ConfirmationDialog component, and I think the default experience with asynchronous accept callbacks could be improved.
Currently, the accept callback is not able to be asynchronous. That is, as soon as the accept callback is run, the dialog closes. I am not able to await the API call.
Currently this results in the following experience:
Ideally:
i. Maybe during this time, the dialog cannot be closed, the 'cancel' button is disabled, and the 'accept' button is loading?
Here is a crude implementation of these changes. If there is some positive feedback here, and this feature could be implemented, I'd be happy to expand this to cover other similar components, e.g. ConfirmationPopup: joemaylor/primevue@7ccfe52
Beta Was this translation helpful? Give feedback.
All reactions