Repository navigation
Commit 96806fe
committed
fix(web): the session timer's init() runs once per page load
Alpine calls init() for an x-data object that defines one, and the
markup also says x-init="init()", so the page called it twice. The
earlier fix (#14 journey) made only the listener registration
idempotent and left the fetches to run again as "idempotent". The RED
before this commit shows they are not: two /api/session/state reads
race, the picker settles on the first, and the second can land after a
session was started elsewhere and adopt it — the CI artifact of run
35516418191, byte for byte.
init() is now a once-per-instance gate over the former body
(_initOnce): later calls return the first run's promise, so the settled
picker is the one and only read, and the _listenersRegistered guard is
subsumed. The e2e click-site comment records what the artifact showed
and keeps the capture for any fourth occurrence, which would have to be
a different mechanism.
Verified on this branch: node --test 148/148 (147 + the RED, now
green); the recovery journey e2e file 9 passed / 2 skipped in order;
ruff clean.1 parent 60d5f94 commit 96806fe
2 files changed
Lines changed: 37 additions & 20 deletions
File tree
- packages/studyloop
- src/studyloop/web/static/js/components
- tests/e2e
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
132 | 132 | | |
133 | 133 | | |
134 | 134 | | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
135 | 138 | | |
136 | 139 | | |
137 | 140 | | |
| |||
165 | 168 | | |
166 | 169 | | |
167 | 170 | | |
168 | | - | |
| 171 | + | |
169 | 172 | | |
170 | | - | |
171 | | - | |
172 | | - | |
173 | | - | |
174 | | - | |
175 | | - | |
176 | | - | |
177 | | - | |
178 | | - | |
179 | | - | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
180 | 192 | | |
181 | 193 | | |
182 | 194 | | |
| |||
293 | 305 | | |
294 | 306 | | |
295 | 307 | | |
296 | | - | |
| 308 | + | |
297 | 309 | | |
298 | 310 | | |
299 | 311 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
347 | 347 | | |
348 | 348 | | |
349 | 349 | | |
350 | | - | |
351 | | - | |
352 | | - | |
353 | | - | |
354 | | - | |
355 | | - | |
356 | | - | |
357 | | - | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
358 | 363 | | |
359 | 364 | | |
360 | 365 | | |
| |||
0 commit comments