Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions packages/core/application/application-common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,11 @@ export class ApplicationCommon {
const rootView = this.getRootView();
this.livesync(rootView, context);
};

// The process can outlive an exit and open a new window, which has to fire launch again.
this.on(this.exitEvent, () => {
this._launchBridgeConsumed = false;
});
}

/**
Expand Down
13 changes: 13 additions & 0 deletions packages/core/application/window-content-resolver.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,19 @@ describe('window content resolution', () => {
expect(launched).toHaveBeenCalledTimes(1);
});

it('fires again for the next window after the app exits', () => {
const launched = vi.fn();
app.on('launch', launched);
const reopened = new TestWindow('window-2', true);

app._resolveWindowContent(window, request);
app.notify({ eventName: app.exitEvent, object: app });
app._resolveWindowContent(reopened, { window: reopened, isPrimary: true });

expect(launched).toHaveBeenCalledTimes(2);
expect(reopened.rootView).toBe(mainEntryView);
});

it('never fires once a resolver has answered the first window', () => {
const launched = vi.fn();
app.on('launch', launched);
Expand Down