fix epoch funkiness in minimalState
This commit is contained in:
1 parent
ad2c57f1c0
commit
9096461658
1 file changed
+6
@@ -32,6 +32,12 @@ function createStore() {
|
|||||||
const initialState = (import.meta as any).env?.DEV ? fullMockState : minimalState;
|
const initialState = (import.meta as any).env?.DEV ? fullMockState : minimalState;
|
||||||
let state = $state<CultivarState>(deepClone(initialState));
|
let state = $state<CultivarState>(deepClone(initialState));
|
||||||
|
|
||||||
|
// Seed maintenance timestamps on first-time startup so cadence measures
|
||||||
|
// "days since first boot", not "days since the Unix epoch".
|
||||||
|
const nowTs = Math.floor(Date.now() / 1000);
|
||||||
|
if (!state.maintenance.last_wipe_ts) state.maintenance.last_wipe_ts = nowTs;
|
||||||
|
if (!state.maintenance.last_reservoir_clean_ts) state.maintenance.last_reservoir_clean_ts = nowTs;
|
||||||
|
|
||||||
let mockInterval: ReturnType<typeof setInterval> | null = null;
|
let mockInterval: ReturnType<typeof setInterval> | null = null;
|
||||||
let ws: WebSocket | null = null;
|
let ws: WebSocket | null = null;
|
||||||
let wsReconnectTimer: ReturnType<typeof setTimeout> | null = null;
|
let wsReconnectTimer: ReturnType<typeof setTimeout> | null = null;
|
||||||
|
|||||||
Reference in new issue
Block a user