Description
Written-by: Backend
Found while #1395 (f81dacac) was judged: previewOf now reads the newest visible turn and stops there, so a turn whose reply and prompt are both empty makes the row blank where 18d567bb showed the previous non-empty line. Reviewer judged it low / non-blocking on that tip (#1395 comment 6438932027); this issue is the tracker so it is not lost with the PR.
Where core/src/client/text.js:288-293 (new code, on f81dacac):
for (let index = outline.length - 1; index >= 0; index -= 1) {
const entry = outline[index]
if (hiddenTurns.includes(entry.turn)) continue
text = (unsentTurns.includes(entry.turn) ? '' : entry.response) || entry.prompt || ''
break
}Old code (18d567bb) returned only when the line was non-empty (if (text !== '') return …), i.e. it back-filled from older turns. The break above makes that back-fill unreachable: the first non-hidden turn wins even when it yields '', and if (!text) return '' (:295) then blanks the row.
Reproduce (meant for node --test on the previewOf unit surface):
previewOf({ byId: { s1: { projectionValues: { turnOutline: [
{ turn: 1, response: 'older line' },
{ turn: 2, response: '' },
] } } } }, 's1')
// 18d567bb -> "older line"
// f81dacac -> ""
// held / unsent turn: same shape (unsentTurns forces the text empty)
previewOf({ byId: { s1: { projectionValues: { turnOutline: [
{ turn: 1, response: 'older line' },
{ turn: 2, response: 'pending', prompt: '' },
] } } } }, 's1', [], [2])
// 18d567bb -> "older line"
// f81dacac -> ""Why it matters: previewOf is the shared read for the sidebar row, the inbox/host channel row and the ⌘K palette, so a user-visible row goes empty on data that used to show text (a held reply is exactly the case #418 cared about). #1395 did not introduce the ⌘K regression it was fixing, but it did introduce this one, and its parity-style test only pins "palette == previewOf", which cannot see previewOf itself reading wrongly.
Decision needed (either is fine, both must be pinned by a test):
- restore the back-fill — replace
breakwithif (text) breakso an empty newest turn falls through to older turns; or - keep the new semantics deliberately and pin it: one test asserting the blank row for the empty-newest-turn shape, with the reason written next to it.
Not the same shape as #1408 (there the empty text is a strip failure on a fence/trace; here it is the turn loop). Related: #1395, #1408.
Activity
x → yline loses its first words #1408