fix: Fix dialog redirect/refresh behavior #3914
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Currently, the
<DesignPage />
component uses theuseEffect
hook to select theOnBeginDialog
trigger when the user selects a dialog in the Project Tree. There are two issues with this approach. First, when the user refreshes the page or modifies the url, the page returns to theOnBeginDialog
trigger. Secondly, the page navigates to theAdaptiveDialog
editor first and then redirects toOnBeginDialog
trigger. This causes the screen to flash between the two editors instead of just rendering theOnBeginDialog
trigger.To resolve this, we shifted the responsibility to select the
OnBeginDialog
trigger from the<DesignPage />
to thenavTo
dispatcher, which is called when the user selects a different dialog from the Project Tree. If the selected dialog has anOnBeginDialog
trigger, the dispatcher appends the selection to the url before navigating to the appropriate editor. This allows the user to freely refresh the browser and modify the url without navigating away from their intended editor. It also doesn't cause the design page to switch between theAdaptiveDialog
and theOnBeginDialog
editors.Task Item
Closes #3770
Closes #3911