DYN-10261 Deselect note and node when unpinning#16953
Merged
jasonstratton merged 4 commits intoMar 11, 2026
Merged
Conversation
There was a problem hiding this comment.
See the ticket for this pull request: https://jira.autodesk.com/browse/DYN-10261
Contributor
There was a problem hiding this comment.
Pull request overview
This PR addresses DYN-10261 by ensuring the workspace selection state is updated appropriately when a note is unpinned from a node, including consistent behavior across undo/redo.
Changes:
- Clear selection when unpinning a note from a node.
- On undo (re-pin), ensure both the node and note are selected; on redo (unpin), selection is cleared again.
- Add an NUnit UI test covering unpin + undo/redo selection behavior.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
test/DynamoCoreWpf3Tests/NoteViewTests.cs |
Adds a regression test validating selection state for unpin/undo/redo. |
src/DynamoCoreWpf/ViewModels/Core/NoteViewModel.cs |
Updates unpin logic to clear selection and records undo for unpin; adjusts undo/redo selection behavior. |
41cf175 to
b7a4b38
Compare
The Pin branch of note_PinUnpinToNode called PinToNode without setting SuppressUndoRecording. Since PinToNode records a modification via UndoRecorder and RecordModificationForUndo clears the redo stack, this could corrupt the undo/redo stack in longer undo chains by pushing a duplicate entry and wiping redo history. Set SuppressUndoRecording = true before calling PinToNode, matching the pattern already used in the Unpin branch. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
zeusongit
approved these changes
Mar 11, 2026
Contributor
3 tasks
This file contains hidden or 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
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.



Purpose
DYN-10261 — When unpinning a note from a node, both remain selected, which is confusing since they are no longer a unit. This PR clears the selection on unpin and ensures undo/redo maintain correct selection state.
Acceptance Criteria:
Declarations
Changes
NoteViewModel.cs(src/DynamoCoreWpf/ViewModels/Core/)UnpinFromNode: Wrapped upstream's multi-model undo recording inside aSuppressUndoRecordingguard so undo/redo paths don't push duplicate entries. AddedClearSelection()after unpin.note_PinUnpinToNode(Unpin branch): SetSuppressUndoRecording = truebefore callingUnpinFromNodefrom undo/redo.note_PinUnpinToNode(Pin branch): AddedSelection.AddUnique(Model)so both note and node are selected when undo re-pins.note_PropertyChanged(PinnedNode case): Added selection handling for theDeserializeCoreundo/redo path — select both when re-pinned, clear when unpinned.WorkspaceModel.cs(src/DynamoCore/Graph/Workspaces/)note.Workspace = thisfor notes passed via the constructor. Previously onlyAddNote()set this reference, so notes loaded from.dynfiles hadWorkspace == null, causingDeserializeCoreto fail to restorePinnedNodeduring undo. This was a pre-existing bug exposed by the new undo tests.NoteViewTests.cs(test/DynamoCoreWpf3Tests/)UnpinClearsSelection_UndoRedoSelectsAndClearsCorrectlycovering all three acceptance criteria in a single unpin → undo → redo flow.Release Notes
Clear the selection when unpinning a note from a node. Undo re-pins and re-selects both; redo unpins and clears the selection. Also fixed a pre-existing bug where
NoteModel.Workspacewas not set for notes loaded from file, which prevented undo of pin/unpin operations from restoring the pinned state.Developer Notes
DynaNotes DYN-10261
Reviewers
(Assign reviewer)
FYIs
N/A