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

ConfirmDialog won't the reject event be triggered when closing things? #2821

Closed
terranc opened this issue Jul 31, 2022 · 2 comments
Closed
Assignees
Labels
Type: Bug Issue contains a bug related to a specific component. Something about the component is not working
Milestone

Comments

@terranc
Copy link

terranc commented Jul 31, 2022

Describe the bug

ConfirmDialog won't the reject event be triggered when closing things?
What is the best practice to listen to the close event?

Reproducer

https://codesandbox.io/s/nostalgic-https-31pz16?file=/src/ConfirmDialogDemo.vue

PrimeVue version

3.15

Vue version

3.x

Language

ALL

Build / Runtime

Vue CLI App

Browser(s)

No response

Steps to reproduce the behavior

No response

Expected behavior

No response

@terranc terranc added the Type: Bug Issue contains a bug related to a specific component. Something about the component is not working label Jul 31, 2022
@some-user123
Copy link

Same issue here. I'd appreciate a "Promise variant" of the ConfirmDialog (and ideally the other dialog options as well).
I'm used to work with promises. To my understanding using promises is a more modern JavaScript and produces better code than using callbacks.

In principle one can "promisify" the function on its own, e.g.

async function confDialog() {
      return new Promise<boolean>((resolve) => {
        confirm.require({
          message: 'Are you sure you want to proceed?',
          header: 'Confirmation',
          icon: 'pi pi-exclamation-triangle',
          accept: () => resolve(true),
          reject: () => resolve(false),
        })
      })
    }

But if the ConfirmDialog is just closed, there is no way to catch this and call resolve(false). There I fully support this issue!

@tugcekucukoglu
Copy link
Member

Fixed via #2938

@tugcekucukoglu tugcekucukoglu added this to the 3.17.0 milestone Sep 8, 2022
@tugcekucukoglu tugcekucukoglu self-assigned this Sep 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Issue contains a bug related to a specific component. Something about the component is not working
Projects
None yet
Development

No branches or pull requests

3 participants