@pi-kaush/pi-content-layout 0.1.10 → 0.1.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +5 -0
- package/package.json +1 -1
- package/src/container-hooks.ts +6 -0
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
## Unreleased
|
|
4
4
|
|
|
5
|
+
- Roll back a chat-container hook that mutates the child list and then throws.
|
|
6
|
+
Its edit used to stick, dropping those rows from every later render. The
|
|
7
|
+
contract is shared by copy with pi-tool-call-markers, so both copies changed
|
|
8
|
+
together.
|
|
9
|
+
|
|
5
10
|
- Pad the submitted-prompt box with two columns on the right of the text so
|
|
6
11
|
it matches the two-column visual gap the quarter-block rail leaves on the
|
|
7
12
|
left; previously wrapped content sat one column off the right edge.
|
package/package.json
CHANGED
package/src/container-hooks.ts
CHANGED
|
@@ -36,11 +36,17 @@ export function runChatContainerHooks(
|
|
|
36
36
|
const restores: Array<() => void> = [];
|
|
37
37
|
if (Array.isArray(children)) {
|
|
38
38
|
for (const hook of chatContainerHooks()) {
|
|
39
|
+
// A hook rewrites `children` and hands back its own undo. Snapshot first:
|
|
40
|
+
// a hook that throws after splicing rows out would otherwise leave them
|
|
41
|
+
// missing from every later render, with nothing left to restore them.
|
|
42
|
+
const before = [...children];
|
|
39
43
|
try {
|
|
40
44
|
const restore = hook(container, children, width);
|
|
41
45
|
if (typeof restore === "function") restores.push(restore);
|
|
42
46
|
} catch {
|
|
43
47
|
// Hooks are cosmetic; one failing hook must not break rendering.
|
|
48
|
+
children.length = 0;
|
|
49
|
+
children.push(...before);
|
|
44
50
|
}
|
|
45
51
|
}
|
|
46
52
|
}
|