Skip to content

Commit a6554e5

Browse files
committed
fix(core): fire launch again for the first window after exit
1 parent 6bb01ea commit a6554e5

2 files changed

Lines changed: 18 additions & 0 deletions

File tree

‎packages/core/application/application-common.ts‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,11 @@ export class ApplicationCommon {
274274
const rootView = this.getRootView();
275275
this.livesync(rootView, context);
276276
};
277+
278+
// The process can outlive an exit and open a new window, which has to fire launch again.
279+
this.on(this.exitEvent, () => {
280+
this._launchBridgeConsumed = false;
281+
});
277282
}
278283

279284
/**

‎packages/core/application/window-content-resolver.spec.ts‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,19 @@ describe('window content resolution', () => {
270270
expect(launched).toHaveBeenCalledTimes(1);
271271
});
272272

273+
it('fires again for the next window after the app exits', () => {
274+
const launched = vi.fn();
275+
app.on('launch', launched);
276+
const reopened = new TestWindow('window-2', true);
277+
278+
app._resolveWindowContent(window, request);
279+
app.notify({ eventName: app.exitEvent, object: app });
280+
app._resolveWindowContent(reopened, { window: reopened, isPrimary: true });
281+
282+
expect(launched).toHaveBeenCalledTimes(2);
283+
expect(reopened.rootView).toBe(mainEntryView);
284+
});
285+
273286
it('never fires once a resolver has answered the first window', () => {
274287
const launched = vi.fn();
275288
app.on('launch', launched);

0 commit comments

Comments
 (0)