You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
constSTREAM_SOURCE=`Here is a tiny streamed answer.
12
+
constSTREAM_SOURCE=`Here is a longer streamed answer used to stress GitHub-flavored markdown streaming on iOS.
13
13
14
-
First table:
14
+
The goal is to keep normal text flowing while completed tables and block LaTeX views stay stable. Each section below adds enough text between block views to make layout changes easier to notice during streaming.
15
15
16
-
| Item | Value |
17
-
| --- | ---: |
18
-
| Alpha | 1 |
19
-
| Beta | 2 |
16
+
First summary table:
17
+
18
+
| Area | Why it matters | Expected behavior |
19
+
| --- | --- | --- |
20
+
| Text | Keeps streaming frequently | Tail text fades in |
| Math | Expensive native block | Existing formula is reused |
23
+
24
+
After the first table, the answer continues with regular prose. This paragraph should stream normally and should not cause the completed table above to be recreated. It gives the preview enough height to make jumps and delayed measurements visible.
20
25
21
26
First LaTeX block:
22
27
23
28
$$
24
29
E = mc^2
25
30
$$
26
31
27
-
Second table:
32
+
The first equation is intentionally short. The following text continues immediately after it so we can verify that the math block appears once, then remains stable while more text is appended below.
28
33
29
-
| Step | Status |
30
-
| --- | --- |
31
-
| Parse | done |
32
-
| Render | streaming |
34
+
Second progress table:
35
+
36
+
| Step | Status | Notes |
37
+
| --- | --- | --- |
38
+
| Parse markdown | done | AST is ready |
39
+
| Split segments | done | Text, table, and math are separated |
40
+
| Reconcile views | active | Unchanged blocks should be reused |
41
+
| Measure height | active | Height should update only when needed |
42
+
43
+
The stream now adds a longer paragraph to simulate a real assistant response. The important thing is that appending this text should not force the previous table or formula to flash, fade again, or rebuild their native views.
33
44
34
45
Second LaTeX block:
35
46
36
47
$$
37
48
a^2 + b^2 = c^2
38
49
$$
39
50
40
-
Final table:
51
+
More explanatory text follows the second formula. This gives us another opportunity to check that previously completed blocks remain visually stable while the tail of the message continues to animate.
| Incomplete table | Renders as parser allows | Hidden until complete |
59
+
| Complete math block | Renders immediately | Renders when complete |
60
+
| Incomplete math block | Renders as parser allows | Hidden until closing delimiter |
61
+
62
+
This paragraph is intentionally a little longer. It should make the preview scrollable and help us see whether the UI thread stays smooth when several completed block views already exist above the streaming tail.
63
+
64
+
Third LaTeX block:
65
+
66
+
$$
67
+
F(x) = \\int_0^x t^2\\,dt = \\frac{x^3}{3}
68
+
$$
69
+
70
+
Final validation table:
41
71
42
-
| Block | Kind |
72
+
| Check | Result |
43
73
| --- | --- |
44
-
| One | text |
45
-
| Two | table |
46
-
| Three | math |
74
+
| Text keeps streaming | expected |
75
+
| Completed tables stay visible | expected |
76
+
| Completed math stays visible | expected |
77
+
| Incomplete block is hidden | expected |
78
+
| Height grows only for rendered content | expected |
47
79
48
-
Done.`;
80
+
The streamed answer is complete. At this point all tables and block LaTeX sections should be visible, and none of the earlier blocks should have been recreated unnecessarily while the final text was appended.`;
0 commit comments