Commit aa7aa8e
committed
feat(logs): newest-first log order (latest on top, older below) — admin + live
Logs now show the latest line at the TOP with older lines moving down, on both
the public /live page and admin. Implemented by prepending instead of appending:
- appendLog: insertBefore(div, firstChild) → newest at top; scrollTop=0 keeps it
in view; trim removes lastChild (oldest) off the bottom.
- live seedLogBacklog: unchanged loop (oldest→newest) now lands newest on top via
the prepend; final scroll to top.
- admin appendLogBatch: build the fragment newest→oldest and prepend the whole
batch; trim the oldest off the tail.
- admin setLogFilter: scroll to top after filtering.
Optimized: writing scrollTop=0 (instead of reading scrollHeight) avoids the
forced synchronous layout reflow the old append path triggered per line — the
batch path stays single-reflow and O(cap).
Tests: admin-log-batch updated for newest-first (fake DOM insertBefore now
expands fragments + exposes lastChild; new assertions lock newest-at-head for
the batch, single-line, and trim paths). Full suite green.1 parent 1aed0ae commit aa7aa8e
3 files changed
Lines changed: 57 additions & 27 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2101 | 2101 | | |
2102 | 2102 | | |
2103 | 2103 | | |
2104 | | - | |
| 2104 | + | |
2105 | 2105 | | |
2106 | 2106 | | |
2107 | 2107 | | |
| |||
2161 | 2161 | | |
2162 | 2162 | | |
2163 | 2163 | | |
2164 | | - | |
2165 | | - | |
2166 | | - | |
| 2164 | + | |
| 2165 | + | |
| 2166 | + | |
| 2167 | + | |
| 2168 | + | |
| 2169 | + | |
2167 | 2170 | | |
2168 | 2171 | | |
2169 | 2172 | | |
| |||
2179 | 2182 | | |
2180 | 2183 | | |
2181 | 2184 | | |
2182 | | - | |
2183 | | - | |
2184 | | - | |
| 2185 | + | |
| 2186 | + | |
| 2187 | + | |
| 2188 | + | |
| 2189 | + | |
2185 | 2190 | | |
2186 | 2191 | | |
2187 | | - | |
2188 | | - | |
2189 | | - | |
| 2192 | + | |
| 2193 | + | |
| 2194 | + | |
| 2195 | + | |
| 2196 | + | |
2190 | 2197 | | |
2191 | 2198 | | |
2192 | 2199 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
923 | 923 | | |
924 | 924 | | |
925 | 925 | | |
926 | | - | |
927 | | - | |
928 | | - | |
929 | | - | |
| 926 | + | |
| 927 | + | |
| 928 | + | |
| 929 | + | |
930 | 930 | | |
931 | 931 | | |
932 | 932 | | |
| |||
938 | 938 | | |
939 | 939 | | |
940 | 940 | | |
941 | | - | |
| 941 | + | |
942 | 942 | | |
943 | 943 | | |
944 | 944 | | |
| |||
1128 | 1128 | | |
1129 | 1129 | | |
1130 | 1130 | | |
1131 | | - | |
1132 | | - | |
| 1131 | + | |
| 1132 | + | |
1133 | 1133 | | |
1134 | 1134 | | |
1135 | 1135 | | |
| |||
1547 | 1547 | | |
1548 | 1548 | | |
1549 | 1549 | | |
1550 | | - | |
| 1550 | + | |
| 1551 | + | |
| 1552 | + | |
1551 | 1553 | | |
1552 | | - | |
1553 | | - | |
1554 | | - | |
1555 | | - | |
| 1554 | + | |
| 1555 | + | |
| 1556 | + | |
| 1557 | + | |
1556 | 1558 | | |
1557 | 1559 | | |
1558 | 1560 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
14 | 18 | | |
15 | 19 | | |
16 | 20 | | |
| |||
63 | 67 | | |
64 | 68 | | |
65 | 69 | | |
| 70 | + | |
66 | 71 | | |
67 | 72 | | |
68 | 73 | | |
69 | 74 | | |
70 | 75 | | |
71 | | - | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
72 | 82 | | |
73 | 83 | | |
74 | 84 | | |
| |||
115 | 125 | | |
116 | 126 | | |
117 | 127 | | |
118 | | - | |
119 | | - | |
120 | | - | |
121 | | - | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
122 | 133 | | |
123 | 134 | | |
124 | 135 | | |
| |||
127 | 138 | | |
128 | 139 | | |
129 | 140 | | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
130 | 145 | | |
131 | 146 | | |
132 | 147 | | |
| |||
143 | 158 | | |
144 | 159 | | |
145 | 160 | | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
146 | 167 | | |
147 | 168 | | |
148 | 169 | | |
| |||
0 commit comments