Skip to content

Commit bdac90d

Browse files
committed
fix: preload onboarding state before startup
1 parent 4bc626a commit bdac90d

File tree

3 files changed

+32
-6
lines changed

3 files changed

+32
-6
lines changed

client/app.js

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9416,16 +9416,27 @@ class ClaudeOrchestrator {
94169416
})
94179417
};
94189418
};
9419-
const persistedSetupState = {
9420-
loaded: false,
9421-
loadPromise: null,
9422-
savePromise: Promise.resolve(),
9423-
current: normalizeSetupState({
9419+
const readBootstrapSetupState = () => {
9420+
try {
9421+
const bootstrapState = window.__ORCHESTRATOR_SETUP_STATE__;
9422+
if (bootstrapState && typeof bootstrapState === 'object') {
9423+
return normalizeSetupState(bootstrapState);
9424+
}
9425+
} catch {
9426+
// ignore and fall back to legacy/local state
9427+
}
9428+
return normalizeSetupState({
94249429
dismissed: readLegacyBool(dismissKey),
94259430
completed: readLegacyBool(completedKey),
94269431
currentStep: readLegacyStep(),
94279432
skippedActionIds: readLegacySkippedActionIds()
9428-
})
9433+
});
9434+
};
9435+
const persistedSetupState = {
9436+
loaded: false,
9437+
loadPromise: null,
9438+
savePromise: Promise.resolve(),
9439+
current: readBootstrapSetupState()
94299440
};
94309441
const syncLegacySetupState = () => {
94319442
const current = persistedSetupState.current || normalizeSetupState({});

client/index.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1075,6 +1075,7 @@ <h3>Notifications</h3>
10751075
<script src="voice-control.js"></script>
10761076
<script src="conversation-browser.js"></script>
10771077
<script src="activity-feed.js"></script>
1078+
<script src="/bootstrap/setup-state.js"></script>
10781079
<script src="app.js"></script>
10791080
<!-- Focus Overlay -->
10801081
<div id="focus-overlay" class="focus-overlay">

server/index.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,20 @@ app.use((req, res, next) => {
211211
});
212212

213213
// Define specific routes BEFORE static file serving
214+
app.get('/bootstrap/setup-state.js', (req, res) => {
215+
try {
216+
const state = onboardingStateService.getDependencySetupState();
217+
res.type('application/javascript');
218+
res.set('Cache-Control', 'no-store');
219+
res.send(`window.__ORCHESTRATOR_SETUP_STATE__ = ${JSON.stringify(state)};`);
220+
} catch (error) {
221+
logger.error('Failed to serve setup bootstrap state', { error: error.message, stack: error.stack });
222+
res.type('application/javascript');
223+
res.set('Cache-Control', 'no-store');
224+
res.send('window.__ORCHESTRATOR_SETUP_STATE__ = null;');
225+
}
226+
});
227+
214228
// Serve the UI as default
215229
app.get('/', (req, res) => {
216230
res.sendFile(path.join(__dirname, '../client/index.html'));

0 commit comments

Comments
 (0)