feat(ui): reworked workflow loading flow #7769
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.
Summary
This PR reworks the workflow loading hooks to standardize their API. We support loading workflows from 4 sources:
File
objectPreviously, the logic to handle these loading sources was scattered and the API to use them was convoluted and inconsistent. This made it difficult to implement a consistent UX for each loading method.
For example, it was rather unpleasant to show a confirmation dialog when there were unsaved changes in the workflow editor, and for some load methods we didn't have a good way to handle success or failure.
The logic is now broken up into 3 pieces:
All places where we load a workflow now use the high-level hook. When loading a workflow, the caller can provide callbacks for success, error and final completion.
Though not included in this PR, this makes it a whole heck of a lot easier to add Save buttons to the unsaved changes dialog.
Also changed the unsaved changes dialog button from "Accept" to "Load".
Side-note: A really nice DX could be to make the dialog
await
able. So you could do something like:I couldn't wrap my head around it without making deeper changes so I didn't waste time on it. But something like this would make a lot of otherwise tricky user experiences soooo much easier to implement.
Related Issues / Discussions
n/a
QA Instructions
Try out loading workflows. There are several pathways:
w
hotkeyI think that's all, I traced all references to the loading code.
Merge Plan
n/a
Checklist
What's New
copy (if doing a release after this PR)