Skip to content

Conversation

@dnenov
Copy link
Collaborator

@dnenov dnenov commented Oct 16, 2025

Purpose

Problem
Packages published successfully but showed validation error instead of success page.

Root Cause
ClearAllEntries() was called immediately after OnPublishSuccess(), clearing form data before the frontend received the success notification, causing validation to fail.

  • Removed ClearAllEntries() from publish success flow
  • Form now clears only when user clicks "Done" or "Reset" from success page
  • Updated validation to check both PackageContents and PreviewPackageContents (fixes .dyf edge case)

Declarations

Check these if you believe they are true

Release Notes

  • race condition was preventing packages to be correctly displayed as successfully published
  • removing ClearAllEntries from running as part of the publishing routine resolves the issue
  • correctly uses ClearAllEntries only after the user interacts with the UI after the package is published

Reviewers

@zeusongit
@benglin

FYIs

- race condition was preventing packages to be correctly displayed as successfully published
- removing ClearAllEntries from running as part of the publishing routine resolves the issue
- correctly uses ClearAllEntries only after the user interacts with the UI after the package is published
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-9645

@dnenov dnenov requested a review from benglin October 16, 2025 15:13
Copy link
Contributor

@benglin benglin left a comment

Choose a reason for hiding this comment

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

Thanks for addressing this, @dnenov! The fix makes perfect sense and should prevent the race condition. Just one small adjustment and we’ll be all set!

});
OnPublishSuccess();
// Don't clear entries on success - user needs to see the success state
// Clearing will happen when user clicks Done/Reset from the success page
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice -- this looks like a logical change, since clearing triggers a lot of property change events, and there’s no real urgency to clear the contents right away.

}

if (Name.Length <= 0 && !PackageContents.Any())
if (Name.Length <= 0 && !PackageContents.Any() && !PreviewPackageContents.Any())
Copy link
Contributor

Choose a reason for hiding this comment

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

I think the addition of PreviewPackageContents wasn’t intended to fix the issue, but rather for completeness?

That said, it wasn’t immediately clear to me what PreviewPackageContents was for, so I did some Cursoring to find out. After some back-and-forth, here’s what I found -- if you could integrate this into the code, it might help future readers (and AI agents) understand it more easily. Thanks!

/// <summary>
/// Stores the raw files/folders the user has added for package publishing. Items represent
/// files in their current disk locations, NOT their final locations in the published package.
/// This collection is modified when users add files via `ShowAddFileDialogAndAddCommand`,
/// add directories via `SelectDirectoryAndAddFilesRecursivelyCommand`, or remove items via
/// `RemoveItemCommand`.
/// </summary>
public ObservableCollection<PackageItemRootViewModel> PackageContents { get; set; }

/// <summary>
/// Preview of the final package directory structure before publishing. Shows how files in
/// PackageContents will be organized in the published package. It reorganizes the files
/// into the standard Dynamo package folders (`bin/`, `dyf/`, `extra/`, `doc/`, `pkg.json`)
/// if `RetainFolderStructureOverride == false`, or preserves the user's existing folder
/// structure from PackageContents if `RetainFolderStructureOverride == true`.
/// </summary>
public ObservableCollection<PackageItemRootViewModel> PreviewPackageContents { get; set; }

Copy link
Contributor

@benglin benglin left a comment

Choose a reason for hiding this comment

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

Thanks for accommodating the requests, @dnenov! LGTM! 🚀

@QilongTang QilongTang merged commit 3ce5918 into DynamoDS:master Oct 17, 2025
25 of 27 checks passed
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