fix(hachidori): preserve setup completion while host connects

- Reopen setup only when a reachable host has no dictionaries
This commit is contained in:
sudacode committed 2026-09-24 14:02:27 -07:00
1 parent 52fc1b63e9
commit 874d2c9f1a
2 files changed
+13 -5

No files matched your search

+6 -2
View File
@@ -448,7 +448,7 @@ export function createFirstRunSetupService(deps: {
getSetupStateDictionaryBackend(stored) === getDictionaryBackend()
? stored
: writeState(projectState(stored));
const { configReady, dictionaryCount, externalYomitanConfigured } =
const { configReady, dictionaryCount, externalYomitanConfigured, hachidoriHost } =
await resolveYomitanSetupStatus({
configFilePaths,
getYomitanDictionaryCount: deps.getYomitanDictionaryCount,
@@ -461,7 +461,11 @@ export function createFirstRunSetupService(deps: {
dictionaryCount,
externalYomitanConfigured,
});
if (isSetupCompleted(state) && canFinish) {
// A linked host is usually still connecting at startup, so an unreachable host
// says nothing about its dictionaries; only a reachable empty host reopens setup.
const hostUnreachable =
hachidoriHost?.kind === 'disconnected' || hachidoriHost?.kind === 'unavailable';
if (isSetupCompleted(state) && (canFinish || (configReady && hostUnreachable))) {
completed = true;
return refreshWithState(state);
}