Skip to content

DYN-10516: Refresh Templates and Recent Files from disk dynamically#17168

Closed
jasonstratton wants to merge 5 commits into
DynamoDS:masterfrom
jasonstratton:pr/17161
Closed

DYN-10516: Refresh Templates and Recent Files from disk dynamically#17168
jasonstratton wants to merge 5 commits into
DynamoDS:masterfrom
jasonstratton:pr/17161

Conversation

@jasonstratton

Copy link
Copy Markdown
Contributor

Purpose

DYN-10516: The Dynamo Home screen loaded Templates and Recent Files only at startup. Returning to Home after closing a workspace did not refresh the lists, and clicking a tile whose file had been deleted caused a hang via a WebView2 re-entrancy deadlock triggered by the archive-flavored CanOpen dialog.

Key changes:

  • StartPage.RefreshTemplateFiles() / RefreshRecentFiles() re-read disk on demand; called from HomePage.DynamoViewModel_PropertyChanged whenever ShowStartPage transitions to true, covering workspace-close and Home-button-click paths.
  • StartPage.HandleMissingFilePath() pre-validates a path before opening: shows a clear "file no longer available" dialog, removes the stale entry from both Recent Files and Templates, and returns early — bypassing CanOpen and its nested message pump that caused the hang.
  • HomePage.OpenFile and StartPage.HandleFilePath both call the pre-validate before forwarding to OpenCommand, so neither path can trigger the deadlock.
  • Fixed a double-subscribe on RecentFiles.CollectionChanged in SendRecentGraphsData.
  • SendTemplateData / SendRecentGraphsData now push empty lists instead of skipping, ensuring the WebView clears stale tiles when all files are removed.
  • DynamoCoreWpf.csproj: DynamoHome npm package bumped to 1.0.32.
  • DynamoModel.OpenXmlFileFromPath: removed the now-redundant forceBlockRun parameter following the DYN-9707 ForceBlockRun instance refactor.
  • New localized resource string MessageHomeFileMissing added to Resources.en-US.resx, Resources.resx, and Resources.Designer.cs.

Declarations

Check these if you believe they are true

Release Notes

Fixed a hang when clicking a missing file or template on the Home screen; Templates and Recent Files now refresh from disk each time you return to the Home screen.

Reviewers

(FILL ME IN) Reviewer 1

FYIs

(FILL ME IN, Optional)

Chloepeg and others added 4 commits June 2, 2026 12:47
Add a guard before opening files from the Home screen. `StartPageViewModel` now checks whether the selected Recent file or Template still exists on disk before calling `OpenCommand`.
If the file was deleted or moved while Dynamo is running, Dynamo now shows a clearer missing-file warning, removes the stale item from both `RecentFiles` and `TemplateFiles`, and stops the open flow. This prevents the old behavior where a missing path could trigger a confusing invalid-path warning and leave Home stuck.
`HomePage.OpenFile` uses the same guard for the WebView Home page. When a stale item is removed, it sends refreshed Recent and Template lists back to DynamoHome so the deleted card/list item disappears from the UI.
A new localised resource string was added for the missing-file warning.
Refreshes Home Recent files and Templates whenever the Home page becomes visible.

StartPageViewModel now exposes refresh methods that rebuild TemplateFiles from the current templates folder and rebuild RecentFiles from DynamoViewModel.RecentFiles. HomePage calls these methods when ShowStartPage changes to true, then sends the refreshed data to DynamoHome.

The send methods now also pass empty lists, so if all recent files or templates were deleted or moved, DynamoHome receives [] and clears the stale Home cards.
…-Templates-and-Recent-Files-from-disk-dynamically
Copilot AI review requested due to automatic review settings June 18, 2026 00:03

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

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-10516

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Updates the Dynamo Home screen flow so Templates and Recent Files refresh from disk whenever the start page is shown again, and prevents hangs when a user clicks a tile whose backing file has been deleted.

Changes:

  • Refresh Templates/Recent Files on ShowStartPage == true transitions and push updated (including empty) lists to the WebView UI.
  • Pre-validate file paths before opening to handle missing files with a clear dialog and stale-entry removal, bypassing the prior CanOpen-dialog path that could deadlock WebView2.
  • Fix RecentFiles.CollectionChanged double-subscription; bump DynamoHome package and add localized resource string.

Reviewed changes

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

Show a summary per file
File Description
src/DynamoCoreWpf/Views/HomePage/HomePage.xaml.cs Refreshes templates/recents on start-page show; pushes empty lists; adds missing-file pre-validation in open flow; fixes RecentFiles handler subscription.
src/DynamoCoreWpf/Controls/StartPage.xaml.cs Adds refresh helpers and missing-file handling that prunes stale tiles and shows a localized warning dialog.
src/DynamoCoreWpf/Properties/Resources.resx Adds MessageHomeFileMissing localized string.
src/DynamoCoreWpf/Properties/Resources.en-US.resx Adds MessageHomeFileMissing localized string (en-US).
src/DynamoCoreWpf/Properties/Resources.Designer.cs Adds strongly-typed accessor for MessageHomeFileMissing.
src/DynamoCoreWpf/DynamoCoreWpf.csproj Bumps DynamoHome npm package version to 1.0.32.
Files not reviewed (1)
  • src/DynamoCoreWpf/Properties/Resources.Designer.cs: Generated file

Comment on lines +127 to 142
private async void DynamoViewModel_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
{
if(e.PropertyName == nameof(startPage.DynamoViewModel.ShowStartPage) && dynWebView?.CoreWebView2 != null)
{
dynWebView.CoreWebView2.ExecuteScriptAsync(@$"window.setShowStartPageChanged('{startPage.DynamoViewModel.ShowStartPage}')");
if (startPage.DynamoViewModel.ShowStartPage)
{
startPage.RefreshTemplateFiles();
startPage.RefreshRecentFiles();

await SendTemplateData();
await SendRecentGraphsData();
}

await dynWebView.CoreWebView2.ExecuteScriptAsync(@$"window.setShowStartPageChanged('{startPage.DynamoViewModel.ShowStartPage}')");
}
}
Comment on lines +283 to +287
internal void RefreshTemplateFiles()
{
TemplateFiles.Clear();
LoadTemplates();
}
Comment on lines +705 to +706
RemoveMissingFilePath(RecentFiles, path);
RemoveMissingFilePath(TemplateFiles, path);
Comment on lines +131 to +138
if (startPage.DynamoViewModel.ShowStartPage)
{
startPage.RefreshTemplateFiles();
startPage.RefreshRecentFiles();

await SendTemplateData();
await SendRecentGraphsData();
}
@jasonstratton

Copy link
Copy Markdown
Contributor Author

Closing — this branch inadvertently included upstream implementation commits. Replacing with a clean PR containing only the DynamoHome 1.0.32 version bump.

@sonarqubecloud

Copy link
Copy Markdown

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