Commit a9471e0
fix(format): don't overwrite freshly-refreshed cache on slow API resolve
Sourcery flagged a race in loadWorkspaceTimezone: if the user updated
the timezone via Settings → refreshWorkspaceTimezone while the initial
GET /settings/workspace was still in flight, the eventual resolution
of that GET would overwrite cachedTz (and localStorage) with the stale
server value, silently reverting the user's change until the next
reload.
Fix: in both the success and failure handlers, only write if cachedTz
is still null. If anything else claimed the cache in the meantime,
keep the fresher value.
Reported-by: sourcery-ai[bot] on PR #59
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>1 parent d64ee29 commit a9471e0
1 file changed
Lines changed: 17 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
41 | | - | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
42 | 47 | | |
43 | 48 | | |
44 | 49 | | |
45 | 50 | | |
46 | 51 | | |
47 | 52 | | |
48 | 53 | | |
49 | | - | |
50 | | - | |
51 | | - | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
52 | 61 | | |
53 | 62 | | |
54 | 63 | | |
55 | | - | |
56 | | - | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
57 | 68 | | |
58 | 69 | | |
59 | 70 | | |
| |||
0 commit comments