-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
feat(ui): reworked workflow loading flow #7769
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Edit: Disregard! I think this was happening before based on code changes, but the studioDestination: workflows is not working for me - the modal is not open by default as it should be |
maryhipp
approved these changes
Mar 12, 2025
…the button in library Upload and save as instead of just upload as draft.
…bject instead of only id
There is now a single entrypoint for loading a workflow - `useLoadWorkflowWithDialog`. The hook: Handles loading workflows from various sources. If there are unsaved changes, the user will be prompted to confirm before loading the workflow. It returns a function that: Loads a workflow from various sources. If there are unsaved changes, the user will be prompted to confirm before loading the workflow. The workflow will be loaded immediately if there are no unsaved changes. On success, error or completion, the corresponding callback will be called. WHEW
b2731ec
to
f06e5d3
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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)