Порівняти коміти

...
Автор SHA1 Повідомлення Дата
l0ng-ai 314ac7b954 Merge remote-tracking branch 'origin/main' into pr-6215 2026-11-27 05:17:57 +08:00
l0ng-ai f8c0f5d320 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.
2026-11-26 23:57:26 +08:00
2 змінених файлів з 13 додано та 2 видалено

No files matched your search

+9
Переглянути файл
@@ -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(
+4 -2
Переглянути файл
@@ -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));
}