Commit 2c80150
fix: prevent null reference reading 'error' in MessagesBoundary
normalizeMessages and toSDKMessages access message.error in flatMap
callbacks executed during React render (via useMemo). When a null
element is present in the messages array at runtime (e.g., from
corrupted JSONL deserialization or streaming race conditions),
null.error throws "Cannot read properties of null (reading 'error')".
Add null guards to flatMap/forEach callbacks and optional chaining
on message.error access points in normalizeMessages and
toSDKMessages.
Fixes: React Rendering Error in MessagesBoundary
Co-Authored-By: deepseek-v4-pro[1m] <deepseek-ai@claude-code-best.win>1 parent d3121f0 commit 2c80150
2 files changed
Lines changed: 6 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
753 | 753 | | |
754 | 754 | | |
755 | 755 | | |
| 756 | + | |
756 | 757 | | |
757 | 758 | | |
758 | 759 | | |
| |||
776 | 777 | | |
777 | 778 | | |
778 | 779 | | |
779 | | - | |
| 780 | + | |
780 | 781 | | |
781 | 782 | | |
782 | 783 | | |
| |||
2376 | 2377 | | |
2377 | 2378 | | |
2378 | 2379 | | |
| 2380 | + | |
2379 | 2381 | | |
2380 | 2382 | | |
2381 | 2383 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
| 32 | + | |
32 | 33 | | |
33 | 34 | | |
34 | 35 | | |
| |||
127 | 128 | | |
128 | 129 | | |
129 | 130 | | |
| 131 | + | |
130 | 132 | | |
131 | 133 | | |
132 | 134 | | |
| |||
138 | 140 | | |
139 | 141 | | |
140 | 142 | | |
141 | | - | |
| 143 | + | |
142 | 144 | | |
143 | 145 | | |
144 | 146 | | |
| |||
0 commit comments