fix(ui): check initial retrieval and set as last persisted

This commit is contained in:
psychedelicious
2025-07-25 15:59:01 +10:00
parent 6ea4884b0c
commit 1addeb4b59

View File

@@ -56,8 +56,11 @@ const buildOSSServerBackedDriver = (): {
if (!res.ok) {
throw new Error(`Response status: ${res.status}`);
}
const json = await res.json();
return json;
const text = await res.text();
if (!lastPersistedState.get(key)) {
lastPersistedState.set(key, text);
}
return JSON.parse(text);
} catch (originalError) {
throw new StorageError({
key,
@@ -81,6 +84,7 @@ const buildOSSServerBackedDriver = (): {
if (!res.ok) {
throw new Error(`Response status: ${res.status}`);
}
lastPersistedState.set(key, value);
return value;
} catch (originalError) {