@@ -307,11 +307,12 @@ public async Task<DocumentReloadResult> ReloadDocumentFromDiskAsync(string fileP
307307
308308 var hadUnsavedChanges = doc . GetType ( ) . GetProperty ( "IsChanged" ) ? . GetValue ( doc ) as bool ? ?? false ;
309309
310- // ── Reload strategy: ReloadAsync → CommitDocument → caller shows the doc ──
311- // ReloadAsync returns the new immutable Document; CommitDocument wires it into
312- // DevEnvHost.CurrentSolution via ReplaceDescendent + MakeCurrent so the model
313- // is correct. The caller (HandleReload) then calls ShowDocumentOnUIThread to
314- // navigate the editor to the updated canvas — no close/reopen needed.
310+ // ── Reload strategy: ReloadAsync only — no CommitDocument ───────────────
311+ // Document.ReloadAsync updates DevEnvHost.CurrentSolution internally as part
312+ // of its completion. Calling CommitDocument after it (ReplaceDescendent +
313+ // MakeCurrent) was found to REVERT the state ReloadAsync just set — the nodes
314+ // appear briefly then vanish when vvvv gets focus. Simply awaiting ReloadAsync
315+ // and letting the caller call OpenCanvas is sufficient.
315316
316317 var reloadMethod = doc . GetType ( ) . GetMethod ( "ReloadAsync" ) ;
317318 if ( reloadMethod is null )
@@ -326,14 +327,9 @@ public async Task<DocumentReloadResult> ReloadDocumentFromDiskAsync(string fileP
326327 {
327328 try
328329 {
329- object ? newDoc = null ;
330330 if ( reloadMethod . Invoke ( doc , new object [ ] { true } ) is Task t )
331- {
332331 await t ;
333- newDoc = t . GetType ( ) . GetProperty ( "Result" ) ? . GetValue ( t ) ;
334- }
335- var err = newDoc is not null ? LivePinWriter . CommitDocument ( newDoc ) : "ReloadAsync returned null" ;
336- tcs . SetResult ( err ) ;
332+ tcs . SetResult ( null ) ;
337333 }
338334 catch ( Exception ex ) { tcs . SetResult ( ex . GetBaseException ( ) . Message ) ; }
339335 } , null ) ;
@@ -342,14 +338,9 @@ public async Task<DocumentReloadResult> ReloadDocumentFromDiskAsync(string fileP
342338 {
343339 try
344340 {
345- object ? newDoc = null ;
346341 if ( reloadMethod . Invoke ( doc , new object [ ] { true } ) is Task t )
347- {
348342 await t ;
349- newDoc = t . GetType ( ) . GetProperty ( "Result" ) ? . GetValue ( t ) ;
350- }
351- var err = newDoc is not null ? LivePinWriter . CommitDocument ( newDoc ) : "ReloadAsync returned null" ;
352- tcs . SetResult ( err ) ;
343+ tcs . SetResult ( null ) ;
353344 }
354345 catch ( Exception ex ) { tcs . SetResult ( ex . GetBaseException ( ) . Message ) ; }
355346 }
0 commit comments