Commit c99df73
authored
Provider: single-writer data flow, drop composite hot path, expose remove (#185)
Rework the audit provider's data loading (cleanup plan Phase 6):
- Drop the compositeAuditData memo. The single-audit hot path reads
auditData.requirements directly instead of round-tripping through
getCompositeAuditRequirements, which recomputed per-audit names and
duplicate-course flags no single-audit UI reads. Those calculations
stay in audit-calculations.ts for the future multi-audit feature.
- Split the two racing effects that both wrote auditData (and flashed
null on every switch) into single-responsibility effects:
- Effect A (ids only): keep currentAuditId valid against history,
falling back to the first valid audit; never touches auditData.
- Effect B (sole auditData writer): new observeAuditData() in
audit-storage.ts mirrors observeAuditHistory (initial read + watch,
watch wins over a late initial read). setLoaded(false) on switch so
the loaded gate shows LoadingPage instead of a blank flash.
- Expose removePlannedCourse(courseId) on the context, implemented like
moveCourseToNewSemester over the existing audit-mutations helper
(completed courses are not removable). wipePlannedCourses stays
unexposed.
- Document observeAuditData and the single-writer contract in
docs/architecture.md.1 parent ed2999c commit c99df73
3 files changed
Lines changed: 87 additions & 65 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
106 | 106 | | |
107 | 107 | | |
108 | 108 | | |
109 | | - | |
110 | | - | |
| 109 | + | |
| 110 | + | |
111 | 111 | | |
112 | 112 | | |
113 | 113 | | |
114 | | - | |
115 | | - | |
116 | | - | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
117 | 121 | | |
118 | 122 | | |
119 | 123 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
7 | 6 | | |
8 | 7 | | |
9 | 8 | | |
| |||
14 | 13 | | |
15 | 14 | | |
16 | 15 | | |
| 16 | + | |
17 | 17 | | |
18 | | - | |
19 | | - | |
20 | | - | |
21 | | - | |
22 | | - | |
| 18 | + | |
23 | 19 | | |
24 | 20 | | |
25 | 21 | | |
26 | | - | |
27 | 22 | | |
28 | 23 | | |
29 | 24 | | |
30 | 25 | | |
31 | 26 | | |
32 | 27 | | |
| 28 | + | |
33 | 29 | | |
34 | 30 | | |
35 | 31 | | |
| |||
55 | 51 | | |
56 | 52 | | |
57 | 53 | | |
| 54 | + | |
58 | 55 | | |
59 | 56 | | |
60 | 57 | | |
| |||
79 | 76 | | |
80 | 77 | | |
81 | 78 | | |
82 | | - | |
83 | | - | |
84 | | - | |
85 | | - | |
86 | | - | |
87 | | - | |
88 | | - | |
89 | | - | |
90 | | - | |
91 | | - | |
92 | | - | |
93 | | - | |
94 | | - | |
95 | | - | |
96 | | - | |
97 | | - | |
98 | | - | |
99 | | - | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
100 | 84 | | |
101 | 85 | | |
102 | 86 | | |
| |||
123 | 107 | | |
124 | 108 | | |
125 | 109 | | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
126 | 113 | | |
127 | | - | |
| 114 | + | |
128 | 115 | | |
129 | | - | |
130 | | - | |
131 | | - | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
132 | 127 | | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
133 | 131 | | |
134 | | - | |
| 132 | + | |
135 | 133 | | |
136 | | - | |
137 | | - | |
138 | 134 | | |
139 | | - | |
140 | | - | |
141 | | - | |
142 | | - | |
143 | | - | |
144 | | - | |
145 | | - | |
146 | | - | |
147 | | - | |
148 | | - | |
149 | | - | |
150 | | - | |
151 | | - | |
152 | | - | |
153 | | - | |
154 | | - | |
155 | | - | |
156 | | - | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
157 | 142 | | |
158 | | - | |
159 | | - | |
160 | | - | |
161 | | - | |
162 | | - | |
163 | | - | |
164 | | - | |
165 | | - | |
166 | | - | |
167 | | - | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
168 | 147 | | |
169 | 148 | | |
170 | 149 | | |
| |||
215 | 194 | | |
216 | 195 | | |
217 | 196 | | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
218 | 204 | | |
219 | 205 | | |
220 | 206 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
109 | 109 | | |
110 | 110 | | |
111 | 111 | | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
112 | 144 | | |
113 | 145 | | |
114 | 146 | | |
| |||
0 commit comments