Clear Home loading overlay when deleted files are removed#93
Conversation
PageRecent.tsx: when Dynamo sends refreshed Recent file data through receiveGraphDataFromDotNet(...), DynamoHome now also calls setIsDisabled(false). This hides the loading overlay after a clicked Recent file is found to be deleted and removed from the list. TemplatesContext.tsx: when Dynamo sends refreshed template data through receiveTemplatesDataFromDotNet(...), DynamoHome now calls window.setShowStartPageChanged?.(true). That uses the existing Home visibility handler to clear the loading overlay after a clicked Template is found to be deleted and removed from the list. PageRecent.test.tsx: adds a unit test proving refreshed Recent data clears the loading state. TemplatesContext.test.tsx: adds a unit test proving refreshed template data clears the loading state.
There was a problem hiding this comment.
Pull request overview
Fixes the DynamoHome WebView “Loading” overlay getting stuck by clearing the disabled/loading state when refreshed Recent graphs or Template data is received from the host (typically after a missing/deleted item triggers a refresh).
Changes:
- Clear Recent page loading/disabled state when
window.receiveGraphDataFromDotNetreceives refreshed graph data. - Clear Home loading/disabled state when
window.receiveTemplatesDataFromDotNetreceives refreshed template data. - Add unit tests covering both loading-state clear behaviors.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
src/components/Recent/PageRecent.tsx |
Clears disabled/loading state after refreshed Recent graphs are received. |
src/components/TemplatesContext.tsx |
Clears disabled/loading state after refreshed Templates data is received. |
tests/unit/Recent/PageRecent.test.tsx |
Adds coverage that graph refresh clears loading/disabled state. |
tests/unit/TemplatesContext.test.tsx |
Adds coverage that template refresh clears loading/disabled state. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| try { | ||
| // jsonData is already an object, so no need to parse it | ||
| const data = jsonData; | ||
| setGraphs(data); | ||
| setIsDisabled(false); |
There was a problem hiding this comment.
Agree, but it is low risk. Consider making the change before merging
| try { | ||
| // jsonData is already an object, so no need to parse it | ||
| const data = (jsonData || []).map(normalizeTemplate); | ||
| setTemplates(data); | ||
| window.setShowStartPageChanged?.(true); |
There was a problem hiding this comment.
Agree, but it is low risk. Consider making the change before merging
| act(() => { | ||
| window.receiveGraphDataFromDotNet(mockGraphs); | ||
| }); | ||
| expect(defaultProps.setIsDisabled).toHaveBeenCalledWith(false); |
There was a problem hiding this comment.
Minot and not a big deal.
setIsDisabled is only called once so toHaveBeenCalledWith and toHaveBeenLastCalledWith are essentially equivalent
| act(() => { | ||
| window.receiveTemplatesDataFromDotNet([]); | ||
| }); |
There was a problem hiding this comment.
The expect will never actually fail — it's noise. Ignore
jasonstratton
left a comment
There was a problem hiding this comment.
Looks good. Approved. I will merge.
The first two Copilot comments have some value. Please read them and consider the change in a future PR, but no worries here.
Purpose
This PR addresses DYN-10516.
The changes in the code aim to clear the Home loading overlay when trying to open a deleted or moved Recent file or Template and sends refreshed data back to DynamoHome. Without this, Home remains stuck on “Loading” until the user switched away and returned.
This pr works with : DynamoDS/Dynamo#17161
Changes :
Declarations
Check these if you believe they are true
Release Notes
Home no longer stays stuck on the loading screen after clicking a deleted or moved Recent file or Template.
The disk refresh and missing-file handling live in the Dynamo repo PR, this repo only fixes the WebView loading overlay on the DynamoHome side.
Reviewers
@zeusongit
@DynamoDS/eidos
FYIs
@dnenov
@johnpierson
@jnealb
@jasonstratton