-
Notifications
You must be signed in to change notification settings - Fork 8.8k
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(editor): Add undo/redo support for canvas actions #4787
Conversation
* master: fix: Update padding for resource filters dropdown (#4751) fix: Update workflow save button type and design and share button type (#4752) fix: Update owner badge padding (no-changelog) (#4749) fix: Remove background for resource ownership selector (#4748) fix: Update size of select components in filters dropdown (#4747)
* master: test: Skip e2e check of rendered nodes in node creator (#4761) feat: Add dynamic translations. Change how sharing unavailable is handled (no-changelog) (#4758) ci: Move full E2E tests into their own scheduled workflow (#4757) feat(Todoist Node): Update to use latest api version (#4650) fix(Google Sheets Node): Fix exception if no matching rows are found
* master: fix(editor): JSON view values can be mapped like keys (#4702) test: E2E NDV (#4712) fix: Issue building image with dependency name ending in .vue (no-changelog) (#4773) fix: Register community nodes as known nodes (no-changelog) (#4775) refactor: Codex updates for Item Lists, Markdown and Date & Time (#4772) refactor(editor): Patch ElementUI tooltip memory leak (#4769) refactor: Apply lint rule `cred-class-field-display-name-miscased` (#4762)
…x. Adding debounce to undo/redo keyboard calls
if (this.isNDVOpen && !event.shiftKey) { | ||
const activeNode = this.ndvStore.activeNode; | ||
if (activeNode) { | ||
this.$telemetry.track(`User hit undo in NDV`, { node_type: activeNode.type }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
weird we are not tracking the event itself
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Talked with Nik about it, looks like we are only interested in the fact that users attempted undo here.
}), | ||
getters: { | ||
currentBulkContainsConnectionCommand() { | ||
return (command: AddConnectionCommand): boolean => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not sure what the exact problem here you are solving is.. but maybe this could be more generic.. if each class had a compareTo
method like in Java or a toString
representation, you can use that to check if an instance of that event exists in history
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now thinking about it, this may no longer be necessary. It has happened in some weird scenarios when going back and forward in history that the same connection command would end up in undo due to jsplump connections listeners so this prevents it. This may have stopped now that redo is cleared on each new user action which simplifies navigation options. Will have to check, but the generic approach is the way to go here for sure.
this.suspendRecordingDetachedConnections = true; | ||
this.__addConnection(connection, true); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what if you tracked history changes only in __addConnection
instead of connection bind
event? then you could pass trackHistory: false
and not track events.. and not need this flag to suspend recoding events.. same question applies to other events..
not a huge fan of this flag because it seems flaky and easy thing to mess up...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't like it ether, but found out not all connections are added and removed ind __addConnection
and removeConnection
methods, some are added and removed in those events. For example, if you drag a connection on an empty canvas space, it is removed in the connectionDetached
event (among other situations, hence the flag), also when reconnecting nodes, some connections are pushed straight to store in conncection
event. This made implementation rely on those flags which is a bit of chasing my own tail situation but I couldn't figure out better way to cover all cases.
* master: fix: Use license-sdk v1.6.1 (#4872) feat(editor): Node creator actions (#4696) test(editor): Set e2e test retries (#4870) fix: Increase workflow reactivation max timeout to 1 day (#4869) fix: Stop returning `UNKNOWN ERROR` in the response if an actual error message is available (#4859) fix: Issue listing executions with Postgres (#4856) test(editor): Fix flaky e2e tests (#4779) fix: Use the same entrypoint for custom docker images as for the other images (no-changelog) (#4849) refactor: Deprecate `alwaysOpenEditWindow` for `string` (#4839) fix: Upgrade sse-channel to mitigate CVE-2019-10744 (#4835) # Conflicts: # packages/editor-ui/src/App.vue # packages/editor-ui/src/views/NodeView.vue
* master: fix: Update duplicate action (#4858)
@@ -2620,7 +2620,7 @@ export default mixins( | |||
return; | |||
} | |||
|
|||
if (trackHistory) { | |||
if (trackHistory && !partOfBulkDelete) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why do we need this? should not it just be bundled as part of current bulk action?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nope, bulk action inside this function is used when deleting a single connected node. In that case, it will contain removeNode
and removeConnection
commands. When deleting multiple nodes, this function is called in a loop and recording is started outside of this loop, so starting and stopping recording in each iteration will break the history recording.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
gotcha
@@ -2620,7 +2620,7 @@ export default mixins( | |||
return; | |||
} | |||
|
|||
if (trackHistory && !partOfBulkDelete) { | |||
if (trackHistory && !trackBulk) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nitpick - now it's confusing.. I would change the default to true as trackBulk should track bulk actions..
if (trackHistory && !trackBulk) { | |
if (trackHistory && trackBulk) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah yeah, makes sense.
* master: fix(editor): Avoid adding manual trigger node when webhook node is added (#4887) ci: Add libc6-compat to nightly docker builds (no-changelog) (#4885) fix(Move Binary Data Node): Stringify objects before encoding them in MoveBinaryData (#4882) ci: Upgrade pnpm and turborepo (no-changelog) (#4878) fix(editor): Fix for broken tab navigation (#4881) feat(editor): Add undo/redo support for canvas actions (#4787) fix(Split In Batches Node): Fix issue with pairedItem (#4873) fix: Update duplicate action (#4858) # Conflicts: # packages/editor-ui/src/Interface.ts # packages/editor-ui/src/mixins/history.ts # packages/editor-ui/src/views/NodeView.vue
Got released with |
Closes ADO-69
See comments this Linear ticket for more info about testing.