Provide a button to clear session data (#231)

Fixes #214

---------

Co-authored-by: graphite-app[bot] <96075541+graphite-app[bot]@users.noreply.github.com>
This commit is contained in:
Will Chen
2025-05-22 16:36:45 -07:00
committed by GitHub
parent 830e4ece15
commit e119a670ec
5 changed files with 60 additions and 1 deletions

View File

@@ -0,0 +1,12 @@
import { ipcMain, session } from "electron";
export const registerSessionHandlers = () => {
ipcMain.handle("clear-session-data", async (_event) => {
const defaultAppSession = session.defaultSession;
await defaultAppSession.clearStorageData({
storages: ["cookies", "localstorage"],
});
console.info(`[IPC] All session data cleared for default session`);
});
};

View File

@@ -821,4 +821,8 @@ export class IpcClient {
public async renameBranch(params: RenameBranchParams): Promise<void> {
await this.ipcRenderer.invoke("rename-branch", params);
}
async clearSessionData(): Promise<void> {
return this.ipcRenderer.invoke("clear-session-data");
}
}

View File

@@ -17,6 +17,7 @@ import { registerVersionHandlers } from "./handlers/version_handlers";
import { registerLanguageModelHandlers } from "./handlers/language_model_handlers";
import { registerReleaseNoteHandlers } from "./handlers/release_note_handlers";
import { registerImportHandlers } from "./handlers/import_handlers";
import { registerSessionHandlers } from "./handlers/session_handlers";
export function registerIpcHandlers() {
// Register all IPC handlers by category
@@ -39,4 +40,5 @@ export function registerIpcHandlers() {
registerLanguageModelHandlers();
registerReleaseNoteHandlers();
registerImportHandlers();
registerSessionHandlers();
}