mirror of
https://github.com/Syngnat/GoNavi.git
synced 2026-05-31 08:39:49 +08:00
🐛 fix(ui): 修复命令面板新建查询无响应
- 补充 gonavi:create-query-tab 全局事件监听 - 统一复用 handleNewQuery 创建查询标签页 - 恢复起始工作台与命令面板的新建查询入口 - 增加事件监听回归断言避免后续再次丢失
This commit is contained in:
@@ -158,6 +158,13 @@ describe('tool center menu entries', () => {
|
||||
expect(appSource).toContain('handleCreateConnection, handleManualResetWindowZoom');
|
||||
expect(appSource).toContain('setTheme, toggleAIPanel, useNativeMacWindowControls');
|
||||
});
|
||||
|
||||
it('listens for command search query-tab events and routes them through handleNewQuery', () => {
|
||||
expect(appSource).toContain("window.addEventListener('gonavi:create-query-tab', handleCreateQueryTabEvent as EventListener);");
|
||||
expect(appSource).toContain("window.removeEventListener('gonavi:create-query-tab', handleCreateQueryTabEvent as EventListener);");
|
||||
expect(appSource).toContain('const handleCreateQueryTabEvent = () => {');
|
||||
expect(appSource).toContain('handleNewQuery();');
|
||||
});
|
||||
});
|
||||
|
||||
describe('global appearance tokens', () => {
|
||||
|
||||
@@ -2665,6 +2665,16 @@ function App() {
|
||||
};
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
const handleCreateQueryTabEvent = () => {
|
||||
handleNewQuery();
|
||||
};
|
||||
window.addEventListener('gonavi:create-query-tab', handleCreateQueryTabEvent as EventListener);
|
||||
return () => {
|
||||
window.removeEventListener('gonavi:create-query-tab', handleCreateQueryTabEvent as EventListener);
|
||||
};
|
||||
}, [handleNewQuery]);
|
||||
|
||||
useEffect(() => {
|
||||
if (!isMacRuntime || !useNativeMacWindowControls) {
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user