fix: reset schemaDeclarationRef on JSON parse failure

When UnknownJson decoding fails (malformed file), the schemaDeclarationRef
was not reset to undefined. On a file-watcher reload, a stale $schema value
from a previous successful load would survive and get injected into the next
updateSettings call. Add the missing else branch to reset the ref, consistent
with the file-not-found case.
This commit is contained in:
Cursor Agent committed 2026-03-30 22:54:37 +00:00
1 parent 80475e854c
commit 0e0490b6b1
1 file changed
+2
+2
View File
@@ -228,6 +228,8 @@ const makeServerSettings = Effect.gen(function* () {
? valueRecord[SETTINGS_SCHEMA_DECLARATION_KEY]
: undefined;
yield* Ref.set(schemaDeclarationRef, schemaDeclaration);
} else {
yield* Ref.set(schemaDeclarationRef, undefined);
}
const decoded = Schema.decodeUnknownExit(ServerSettingsJson)(raw);