дзеркало
https://github.com/l0ng-ai/openidea.git
синхронізовано 2026-12-04 09:11:10 +02:00
fix(debugger): don't sync breakpoints to the backend while no project is open
Before a project opens, and after it closes, loading the breakpoint list asked the backend to replace this window's breakpoints, which failed with "no project is open" and logged a warning on every such load. Without a project the backend holds none to replace.
Цей коміт міститься в:
1 джерело
0101d11ac9
коміт
f8c0f5d320
2 files changed
+13
-2
No files matched your search
@@ -188,6 +188,15 @@ it("hands the window's whole list to the backend before startup, even after a fa
|
||||
);
|
||||
});
|
||||
|
||||
it("leaves the backend alone while no project is open", async () => {
|
||||
loadBreakpoints(null);
|
||||
await vi.advanceTimersByTimeAsync(200);
|
||||
expect(ipc.debugReplaceBreakpoints).not.toHaveBeenCalled();
|
||||
loadBreakpoints("/p");
|
||||
await vi.advanceTimersByTimeAsync(0);
|
||||
expect(ipc.debugReplaceBreakpoints).toHaveBeenCalledOnce();
|
||||
});
|
||||
|
||||
it("flushes persisted breakpoints immediately after project loading", async () => {
|
||||
ipc.debugSetBreakpoints.mockResolvedValue({ status: "ok", data: [] });
|
||||
localStorage.setItem(
|
||||
|
||||
@@ -138,8 +138,10 @@ async function drainBreakpoints() {
|
||||
|
||||
/** Makes this window's whole list the backend's: files it no longer lists are cleared there. */
|
||||
async function replaceBreakpoints() {
|
||||
if (!isTauri() || useProject.getState().project?.trusted === false) return;
|
||||
const { byFile, muted } = useBreakpoints.getState();
|
||||
// Without a project (before one opens, after it closes) the backend holds no breakpoints for
|
||||
// this window and has none to clear.
|
||||
const { root, byFile, muted } = useBreakpoints.getState();
|
||||
if (!isTauri() || root === null || useProject.getState().project?.trusted === false) return;
|
||||
const files = Object.fromEntries(Object.entries(byFile).map(([path, list]) => [path, toBackend(list, muted, path)]));
|
||||
await call(commands.debugReplaceBreakpoints(files));
|
||||
}
|
||||
|
||||
Reference in new issue
Заблокувати користувача