I'm currently working on a bot using Microsoft's Bot Framework. This bot has multiple Component dialogs build up from WaterfallDialogs. When my users go through the conversations I split up pieces of this conversation in separate waterfall dialogs, but I've noticed that there are two ways to make this work.
BeginDialog()
Creates a new instance of the dialog and pushes it onto the stack.
ReplaceDialog()
Ends the active dialog and starts a new dialog in its place.
Currently I've not noticed any difference in using these two ways of switching waterfallDialogs. What are the main differences between the two and which should I be using to switch between waterfallDialogs within a single Component Dialog?
beginDialog does not end the current dialog. So if that dialog is not complete, it will continue running after the new dialog or dialogs are popped off the stack. If you are running this as the last step of a waterfall dialog, I think it will technically work but is not considered a best practice. If you have no intention of returning to the currently running dialog, you should replaceDialog since it combines ending of the current dialog with the beginning of the new one.