Retry desktop project bootstrap when list is transiently empty
Co-authored-by: Julius Marminge <[email protected]>
This commit is contained in:
1 parent
5cda771f72
commit
cec360e020
2 files changed
+35
-2
No files matched your search
+12
-2
@@ -124,7 +124,7 @@ function AutoProjectBootstrap() {
|
||||
|
||||
function DesktopProjectBootstrap() {
|
||||
const api = useNativeApi();
|
||||
const { dispatch } = useStore();
|
||||
const { state, dispatch } = useStore();
|
||||
const bootstrappedRef = useRef(false);
|
||||
|
||||
useEffect(() => {
|
||||
@@ -138,6 +138,16 @@ function DesktopProjectBootstrap() {
|
||||
try {
|
||||
const projects = await api.projects.list();
|
||||
if (disposed) return;
|
||||
if (projects.length === 0 && (state.projects.length > 0 || state.threads.length > 0)) {
|
||||
// Avoid wiping hydrated renderer state if the initial projects.list races
|
||||
// backend startup and transiently returns no projects.
|
||||
retryTimer = setTimeout(() => {
|
||||
retryTimer = null;
|
||||
void attemptBootstrap();
|
||||
}, retryDelayMs);
|
||||
retryDelayMs = Math.min(retryDelayMs * 2, 5_000);
|
||||
return;
|
||||
}
|
||||
dispatch({
|
||||
type: "SYNC_PROJECTS",
|
||||
projects: projects.map((project) => ({
|
||||
@@ -167,7 +177,7 @@ function DesktopProjectBootstrap() {
|
||||
clearTimeout(retryTimer);
|
||||
}
|
||||
};
|
||||
}, [api, dispatch]);
|
||||
}, [api, dispatch, state.projects.length, state.threads.length]);
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -668,6 +668,29 @@ async function main() {
|
||||
);
|
||||
}
|
||||
|
||||
const interactionChecks = [];
|
||||
const threadClicks = Number(donePayload.interactions?.threadClicks ?? 0);
|
||||
const typedChars = Number(donePayload.interactions?.typedChars ?? 0);
|
||||
const terminalOpened = donePayload.interactions?.terminal?.openedByShortcut === true;
|
||||
const terminalCommandTouched = donePayload.interactions?.terminal?.commandFileTouched === true;
|
||||
if (threadClicks <= 0) {
|
||||
interactionChecks.push("thread clicks");
|
||||
}
|
||||
if (typedChars <= 0) {
|
||||
interactionChecks.push("typed chars");
|
||||
}
|
||||
if (!terminalOpened) {
|
||||
interactionChecks.push("terminal shortcut open");
|
||||
}
|
||||
if (!terminalCommandTouched) {
|
||||
interactionChecks.push("terminal command execution");
|
||||
}
|
||||
if (interactionChecks.length > 0) {
|
||||
throw new Error(
|
||||
`Desktop perf automation completed without required scripted interactions: ${interactionChecks.join(", ")}`,
|
||||
);
|
||||
}
|
||||
|
||||
const summary = summarizeTrace(tracePath);
|
||||
const markdown = createMarkdownSummary({
|
||||
tracePath,
|
||||
|
||||
Reference in new issue
Block a user