Fix navigation menu config IPC handler error

Resolved ReferenceError: config is not defined in the 'get-config' IPC handler.

Changes:
- Modified IPC handler to read config.json directly using fs.readFileSync
- Added proper error handling with try/catch block
- Added fallback to send empty config if file doesn't exist or can't be read
- Added console logging for debugging config transmission

This fixes the JavaScript error that was displaying on screen and prevents
the navigation menu from loading sites properly.
This commit is contained in:
Claude
2025-12-02 20:19:25 +00:00
parent 08594601ec
commit 5db15802a0
+14 -1
View File
@@ -5283,7 +5283,20 @@ function createWindow(){
});
ipcMain.on('get-config',(event)=>{
event.sender.send('config-data',config);
try{
if(fs.existsSync(CONFIG_FILE)){
const data=fs.readFileSync(CONFIG_FILE,'utf8');
const config=JSON.parse(data);
event.sender.send('config-data',config);
console.log('[NAV] Sent config data to renderer');
}else{
console.error('[NAV] Config file not found');
event.sender.send('config-data',{tabs:[]});
}
}catch(err){
console.error('[NAV] Error reading config:',err);
event.sender.send('config-data',{tabs:[]});
}
});
ipcMain.on('navigate-to-tab',(event,tabIndex)=>{