ConfirmDialog displays stale data -> dialog is not reusable #958
Labels
Type: Bug
Issue contains a bug related to a specific component. Something about the component is not working
Milestone
Hi,
I have a view where there is a list on the left side and the view of the selected item on the right side. The view on the right side has a delete button that uses the bound data of the list.
There is a
<p-confirmDialog></p-confirmDialog>
element in this view to confirm the deletion.When calling
confirm
of theConfirmationService
several times, the dialog still shows the data (header, icon, message) of the firstconfirm
call.The problem lies here: confirmdialog.ts#L100
After the first
confirm
call (or already when defining thep-confirmDialog
element with attributes) the fieldsmessage
,icon
andheader
are filled.This means that ALL subsequent calls will have no effect on these fields, since they are already set.
IMO it should look somehow like this. The dialog fields are only set if the confirmation fields are set - defaults are not overwritten:
Another solution would be to store the values from the HTML attributes in separate variables to not reuse values of old confirm calls.
Would this kinda be the intended behaviour or is it intended, that the dialog element gets created for each confirmation?Edit: The current behavior is not intended according a recent PrimeNg blog post:
The text was updated successfully, but these errors were encountered: