Copilot commented on code in PR #8600:
URL: https://github.com/apache/texera/pull/8600#discussion_r4051213142


##########
frontend/src/app/dashboard/component/user/share-access/share-access.component.ts:
##########
@@ -137,10 +137,19 @@ export class ShareAccessComponent implements OnInit, 
OnDestroy {
         this.owner = name;
       });
     // Stays null for kinds that cannot be published, which is what hides the 
publish buttons.
+    // A failed request leaves it null too, and the buttons are equally gone, 
so say so: without
+    // this the dialog looked complete while quietly offering one control 
fewer, and the only way
+    // to find out was the network tab.
     this.descriptor

Review Comment:
   Several successful access updates call `ngOnInit()` again to refresh this 
dialog. If the publish-state request then fails, `next` is never called and 
`isPublic` retains its previous value, so the notification appears while stale 
Private/Public controls remain enabled. Reset `isPublic` before starting each 
refresh so the controls stay hidden until a current value is available.



##########
frontend/src/app/workspace/component/workspace.component.spec.ts:
##########
@@ -497,6 +497,35 @@ describe("WorkspaceComponent", () => {
       expect(workflowResultService.clearResults).toHaveBeenCalled();
     });
 
+    // A full-page navigation away fires beforeunload, and the browser may 
then keep this document
+    // in its back/forward cache instead of discarding it. Coming back 
restores the JavaScript
+    // state as it was left and re-runs nothing, so anything torn down here 
stays torn down: the
+    // graph came back empty, the workflow id came back as the default, and 
the still-subscribed
+    // autosave then wrote that default out as a new, blank workflow (issue 
#8599).
+    it("saves on beforeunload and tears nothing down, so a page restored from 
the cache still works", async () => {
+      await createFixture();
+      fixture.detectChanges();
+
+      component.onBeforeUnload();

Review Comment:
   This calls `onBeforeUnload()` directly, so the test bypasses Angular's 
`@HostListener` and would still pass if the browser event binding were removed 
or miswired. Dispatch a real `beforeunload` event, as the Form View rendered 
test does, so this regression test covers the user-facing event path.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to