@lobehub/lobehub 2.0.0-next.263 → 2.0.0-next.264
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,31 @@
|
|
|
2
2
|
|
|
3
3
|
# Changelog
|
|
4
4
|
|
|
5
|
+
## [Version 2.0.0-next.264](https://github.com/lobehub/lobe-chat/compare/v2.0.0-next.263...v2.0.0-next.264)
|
|
6
|
+
|
|
7
|
+
<sup>Released on **2026-01-11**</sup>
|
|
8
|
+
|
|
9
|
+
#### 🐛 Bug Fixes
|
|
10
|
+
|
|
11
|
+
- **misc**: Handle will-prevent-unload event to allow app quit.
|
|
12
|
+
|
|
13
|
+
<br/>
|
|
14
|
+
|
|
15
|
+
<details>
|
|
16
|
+
<summary><kbd>Improvements and Fixes</kbd></summary>
|
|
17
|
+
|
|
18
|
+
#### What's fixed
|
|
19
|
+
|
|
20
|
+
- **misc**: Handle will-prevent-unload event to allow app quit, closes [#11406](https://github.com/lobehub/lobe-chat/issues/11406) ([cbeb013](https://github.com/lobehub/lobe-chat/commit/cbeb013))
|
|
21
|
+
|
|
22
|
+
</details>
|
|
23
|
+
|
|
24
|
+
<div align="right">
|
|
25
|
+
|
|
26
|
+
[](#readme-top)
|
|
27
|
+
|
|
28
|
+
</div>
|
|
29
|
+
|
|
5
30
|
## [Version 2.0.0-next.263](https://github.com/lobehub/lobe-chat/compare/v2.0.0-next.262...v2.0.0-next.263)
|
|
6
31
|
|
|
7
32
|
<sup>Released on **2026-01-11**</sup>
|
|
@@ -184,6 +184,20 @@ export default class Browser {
|
|
|
184
184
|
this.setupReadyToShowListener(browserWindow);
|
|
185
185
|
this.setupCloseListener(browserWindow);
|
|
186
186
|
this.setupFocusListener(browserWindow);
|
|
187
|
+
this.setupWillPreventUnloadListener(browserWindow);
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
private setupWillPreventUnloadListener(browserWindow: BrowserWindow): void {
|
|
191
|
+
logger.debug(`[${this.identifier}] Setting up 'will-prevent-unload' event listener.`);
|
|
192
|
+
browserWindow.webContents.on('will-prevent-unload', (event) => {
|
|
193
|
+
logger.debug(
|
|
194
|
+
`[${this.identifier}] 'will-prevent-unload' fired. isQuiting: ${this.app.isQuiting}`,
|
|
195
|
+
);
|
|
196
|
+
if (this.app.isQuiting) {
|
|
197
|
+
logger.info(`[${this.identifier}] App is quitting, ignoring beforeunload cancellation.`);
|
|
198
|
+
event.preventDefault();
|
|
199
|
+
}
|
|
200
|
+
});
|
|
187
201
|
}
|
|
188
202
|
|
|
189
203
|
private setupReadyToShowListener(browserWindow: BrowserWindow): void {
|
|
@@ -40,6 +40,7 @@ const { mockBrowserWindow, mockNativeTheme, mockIpcMain, mockScreen, MockBrowser
|
|
|
40
40
|
onHeadersReceived: vi.fn(),
|
|
41
41
|
},
|
|
42
42
|
},
|
|
43
|
+
on: vi.fn(),
|
|
43
44
|
},
|
|
44
45
|
};
|
|
45
46
|
|
|
@@ -646,4 +647,35 @@ describe('Browser', () => {
|
|
|
646
647
|
expect(mockBrowserWindow.setBackgroundColor).not.toHaveBeenCalled();
|
|
647
648
|
});
|
|
648
649
|
});
|
|
650
|
+
|
|
651
|
+
describe('will-prevent-unload event handling', () => {
|
|
652
|
+
let willPreventUnloadHandler: (e: any) => void;
|
|
653
|
+
|
|
654
|
+
beforeEach(() => {
|
|
655
|
+
// Get the will-prevent-unload handler registered during initialization
|
|
656
|
+
willPreventUnloadHandler = mockBrowserWindow.webContents.on.mock.calls.find(
|
|
657
|
+
(call) => call[0] === 'will-prevent-unload',
|
|
658
|
+
)?.[1];
|
|
659
|
+
});
|
|
660
|
+
|
|
661
|
+
it('should call preventDefault when app is quitting', () => {
|
|
662
|
+
(mockApp as any).isQuiting = true;
|
|
663
|
+
const mockEvent = { preventDefault: vi.fn() };
|
|
664
|
+
|
|
665
|
+
expect(willPreventUnloadHandler).toBeDefined();
|
|
666
|
+
willPreventUnloadHandler(mockEvent);
|
|
667
|
+
|
|
668
|
+
expect(mockEvent.preventDefault).toHaveBeenCalled();
|
|
669
|
+
});
|
|
670
|
+
|
|
671
|
+
it('should not call preventDefault when app is not quitting', () => {
|
|
672
|
+
(mockApp as any).isQuiting = false;
|
|
673
|
+
const mockEvent = { preventDefault: vi.fn() };
|
|
674
|
+
|
|
675
|
+
expect(willPreventUnloadHandler).toBeDefined();
|
|
676
|
+
willPreventUnloadHandler(mockEvent);
|
|
677
|
+
|
|
678
|
+
expect(mockEvent.preventDefault).not.toHaveBeenCalled();
|
|
679
|
+
});
|
|
680
|
+
});
|
|
649
681
|
});
|
package/changelog/v1.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lobehub/lobehub",
|
|
3
|
-
"version": "2.0.0-next.
|
|
3
|
+
"version": "2.0.0-next.264",
|
|
4
4
|
"description": "LobeHub - an open-source,comprehensive AI Agent framework that supports speech synthesis, multimodal, and extensible Function Call plugin system. Supports one-click free deployment of your private ChatGPT/LLM web application.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"framework",
|