Skip to content

Open-source gym & body-weight tracker, now in the App Store (iPhone + Apple Watch) and as an Android APK. Plan routines, log workouts, see which muscles are trained, import from Strong/Hevy/FitNotes. Self-host it or use it on the phone alone.

useStore.tabs-join test: transform the store's heavy imports at collection

Duarte Santosef41a7191c4d
diff --git a/frontend/src/store/useStore.tabs-join.test.jsx b/frontend/src/store/useStore.tabs-join.test.jsx
index 70199d7b8..723e64db7 100644
--- a/frontend/src/store/useStore.tabs-join.test.jsx
+++ b/frontend/src/store/useStore.tabs-join.test.jsx
@@ -12,6 +12,15 @@ const h = vi.hoisted(() => ({ api: null }))
vi.mock('../lib/api.js', () => ({ api: (...a) => h.api(...a), setRemoteAuth: () => {} }))
vi.mock('./useUI.js', () => ({ useUI: { getState: () => ({ toast: () => {}, stopRest: () => {}, abandonWork: () => {} }) } }))
+// The store's heavy imports (the 1 MB exercise table, the sync and mobile libraries) are
+// transformed here, while the file is collected. Cold, that took seconds and was billed to the
+// first test, past its timeout under a parallel run. The store itself is not imported here, so
+// no extra tab listens on the window; vi.resetModules() in openTab keeps the transforms.
+await Promise.all([
+ import('../lib/exercises.js'), import('../lib/mobile.js'), import('../lib/sync-merge.js'), import('../lib/media-store.js'),
+ import('../lib/remote.js'), import('../lib/health-sync.js'), import('../lib/i18n.js'),
+])
+
const clone = v => JSON.parse(JSON.stringify(v))
const w = (id, d = '2026-09-01') => ({ id, d, start: 1, end: 2, entries: [] })
const ids = st => (st?.workouts || []).map(x => x.id).sort()