Skip to content

Conversation

@reddyashish
Copy link
Contributor

@reddyashish reddyashish commented Jul 10, 2025

Purpose

https://jira.autodesk.com/browse/DYN-6236.

The issue was that after save-as operation, we were just updating the workspace name and copying other attributes but the old nodes were linked to the workspace. After this change, we will now be opening the workspace with the new nodes and any subsequent save operation will consider the new nodes in the workspace and the GUIDs won't be reverted back to the original node.

Declarations

Check these if you believe they are true

  • Is documented according to the standards
  • The level of testing this PR includes is appropriate
  • User facing strings, if any, are extracted into *.resx files
  • Snapshot of UI changes, if any.
  • Changes to the API follow Semantic Versioning and are documented in the API Changes document.
  • This PR modifies some build requirements and the readme is updated
  • This PR contains no files larger than 50 MB
  • This PR introduces new feature code involve network connecting and is tested with no-network mode.

Release Notes

[DYN-6236] Save operation after Save-As shouldn't revert node GUID's

Reviewers

@DynamoDS/eidos

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See the ticket for this pull request: https://jira.autodesk.com/browse/DYN-6236

@reddyashish
Copy link
Contributor Author

The only failing test TestReconnectionUndo looks flaky and is passing locally. Running the job again: https://master-5.jenkins.autodesk.com/job/Dynamo/job/DynamoSelfServe/job/pullRequestValidation/18165/

@zeusongit zeusongit requested review from a team and Copilot July 10, 2025 14:50
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR ensures that after performing a Save-As, a subsequent Save does not revert node GUIDs by fully reloading the workspace.

  • Add and run a unit test verifying GUIDs change after Save-As then Save
  • Update workspace save logic to clear and reopen the new file on Save-As
  • Fix null-reference and access modifiers to support the reload flow

Reviewed Changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.

Show a summary per file
File Description
test/UI/BasicAdditionDuplicate.dyn New test graph file used for Save-As GUID uniqueness verification
test/DynamoCoreWpf3Tests/WorkspaceSaving.cs Added WorkspaceSaveAfterSaveAsNewFile test and fixed typo
src/DynamoCoreWpf/Views/Core/NodeView.xaml.cs Made DelayNodePreviewControl.Cancel() null-safe
src/DynamoCoreWpf/ViewModels/Core/WorkspaceViewModel.cs After Save-As, clear and reopen workspace to apply new GUIDs
src/DynamoCoreWpf/ViewModels/Core/DynamoViewModel.cs Assign filePath from current workspace during deserialization
src/DynamoCore/Models/DynamoModel.cs Changed OpenJsonFileFromPath to internal for reuse
Comments suppressed due to low confidence (4)

test/DynamoCoreWpf3Tests/WorkspaceSaving.cs:20

  • The Microsoft.VisualBasic namespace import appears unused. Consider removing it to reduce clutter and avoid unnecessary dependencies.
using Microsoft.VisualBasic;

src/DynamoCoreWpf/Views/Core/NodeView.xaml.cs:2151

  • The local identifier viewModel may not be defined in this scope—previous code uses ViewModel. This will fail to compile; replace viewModel with the correct reference (e.g. ViewModel).
            viewModel.WorkspaceViewModel.DelayNodePreviewControl?.Cancel();

src/DynamoCoreWpf/ViewModels/Core/WorkspaceViewModel.cs:865

  • The variable saveContent is not defined in this method. It looks like you intended to use the JSON string that was just saved (likely fileContents); please correct the variable name to avoid a compile error.
                        DynamoViewModel.Model.OpenJsonFileFromPath(saveContent, filePath, false);

src/DynamoCoreWpf/ViewModels/Core/DynamoViewModel.cs:2348

  • The identifier filePath may not be declared in this scope. If this is intended to set a field, ensure it's declared at class level; otherwise declare a new local variable.
                filePath = Model.CurrentWorkspace.FileName;

{
DynamoViewModel.Model.ClearCurrentWorkspace();
DynamoViewModel.Model.OpenJsonFileFromPath(saveContent, filePath, false);
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happens for .dyf files?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

testing with dyf's

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't see the issue with custom nodes. They are uniquely generated and not reverted to the old ones.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does OpenJsonFileFromPath update WorkspaceModel with the current saveContent?

Copy link
Contributor

@aparajit-pratap aparajit-pratap Jul 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks counterintuitive to clear the current workspace and reopen the json file when one is doing a save-as. Is there a better way to update the workspace model on a save-as? It feels more appropriate to update the workspace model after updating saveContent in line 845.

@reddyashish
Copy link
Contributor Author

@zeusongit zeusongit requested a review from a team July 11, 2025 17:22
@reddyashish
Copy link
Contributor Author

Merging this to get the testing started. If there are any comments from the team, I can address it in a different PR.

@reddyashish reddyashish merged commit 7732b0d into DynamoDS:master Jul 11, 2025
25 of 28 checks passed
{
try
{
filePath = Model.CurrentWorkspace.FileName;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

filepath is assigned but never used?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is used in the next line to read the text from this new current workspace.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants