Commit ea19a15
Fix null createdAt crash in Feedback vote results after Gen2 trigger migration
The Gen1->Gen2 Firestore trigger migration (#1664) made the vote
aggregation fire before serverTimestamp() resolves, writing null
createdAt/updatedAt into aggregated sessionVotes docs. The Feedback app
then crashed on `value2.createdAt.toDate()` with
"TypeError: can't access property toDate, h.createdAt is null".
- aggregateVotes.ts: normalizeVoteTimestamps() falls back to the
snapshot's server-assigned createTime/updateTime when the field is
null, so new aggregated docs never store a null timestamp.
- getVoteResultSelectorSelector.js: guard the .toDate() calls and skip
entries with no usable date, so already-corrupted prod docs no longer
crash the whole results view.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>1 parent aaca0bd commit ea19a15
2 files changed
Lines changed: 33 additions & 4 deletions
File tree
- functions/src/triggers
- src/feedback/talk/core
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
17 | | - | |
| 17 | + | |
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
31 | | - | |
| 31 | + | |
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
36 | 52 | | |
37 | 53 | | |
38 | 54 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
62 | 62 | | |
63 | 63 | | |
64 | 64 | | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
65 | 78 | | |
66 | 79 | | |
67 | | - | |
68 | | - | |
| 80 | + | |
| 81 | + | |
69 | 82 | | |
70 | 83 | | |
71 | 84 | | |
| |||
0 commit comments