Skip to content
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

refactor(ui): merge nodes & workflow slices #7892

Merged

Conversation

psychedelicious
Copy link
Collaborator

Summary

  • Undo/redo history now includes the Workflow Form Builder
  • Improved logic for grouping undo actions

Demo of the improved undo functionality. Note the undo/redo working in form builder, and the "unsaved changes" indicator updating as changes are made (albeit with a short, intentional delay):

Screen.Recording.2025-04-07.at.8.23.22.pm.mov

One problem. I can't find a straightforward way to prevent the user's currently workflow form from being lost on first load after this change is deployed. Unsaved changes are lost, but the user can re-loading the saved workflow restore the form.

This change merges all logic from workflowSlice (workflow name, description, form, etc) into nodesSlice (nodes and edges only).

Ideally, we would write a nodesSlice migration that gets the old workflowSlice data and adds it to nodesSlice on first load of this change. There is an API for slice migrations, but it's not sufficient for this sitaution.

The redux persistence library doesn't give us access to all state when rehydrating a slice from browser storage. You only get the slice that is rehydrating. So in this case, the nodesSlice migration cannot see the workflowSlice and therefore cannot copy the form and other workflow details into itself. The only option is to reset those things to their initial values.

I'm sure it's possible but I'm not sure if it is worth the effort.

Related Issues / Discussions

This PR is based on #7891 and is motivated by some unpleasantries encountered while working on that change. It's also something that's been needing to be done for a while anyways.

QA Instructions

Besides the data loss issue, everything should work the same with better undo/redo action grouping.

Merge Plan

If we move ahead with this change, we should be sure to make a note in the release notes about the data loss.

Checklist

  • The PR has a short but descriptive title, suitable for a changelog
  • Tests added / updated (if applicable)
  • Documentation added / updated (if applicable)
  • Updated What's New copy (if doing a release after this PR)

@psychedelicious psychedelicious marked this pull request as draft April 7, 2025 10:54
@github-actions github-actions bot added the frontend PRs that change frontend files label Apr 7, 2025
@psychedelicious
Copy link
Collaborator Author

Because this targets a branch other than main, it has no merge restrctions. Therefore I am marking it as draft to prevent a premature merge

@psychedelicious psychedelicious force-pushed the psyche/feat/ui/workflow-touched branch from 3ff40b0 to 689bd2f Compare April 7, 2025 20:04
Base automatically changed from psyche/feat/ui/workflow-touched to main April 7, 2025 20:54
@psychedelicious psychedelicious force-pushed the psyche/refactor/ui/merge-nodes-workflow-slices branch from 835ca64 to b82a639 Compare April 7, 2025 21:23
@psychedelicious psychedelicious marked this pull request as ready for review April 7, 2025 21:24
@psychedelicious psychedelicious merged commit b75d1b2 into main Apr 7, 2025
11 checks passed
@psychedelicious psychedelicious deleted the psyche/refactor/ui/merge-nodes-workflow-slices branch April 7, 2025 22:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
frontend PRs that change frontend files
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants