Commit b52e321
committed
fix(comment): dedup edits, preserve drafts, keep bubble open on failure
Four concrete bugs in the comment send flow, plus two UX hardening items.
Layered on top of the liveRects pin-follow-scroll work so anchor math
stays as-is — this change is strictly about the send/edit/close loop.
1. Editing a reopened chip duplicated instead of updating the original.
existingCommentId was defined on the anchor but never consumed. New
submitComment action routes by id: with → updateComment (no new row),
without → addComment. updateComment now returns CommentRow | null so
callers can detect write failures.
2. addComment / updateComment failures (no snapshot, IPC error, validator
reject) silently closed the bubble and wiped the user's draft. The
bubble now checks the return value and stays open on null. The toast
surfaced by the store is enough context for the user.
3. Mousedown-outside auto-close discarded in-flight text whenever the
user clicked any surrounding UI — toolbar, sidebar, preview. Replaced
with explicit Esc / × only, matching chat/dialog norms.
4. React key used selector alone, so two comments on the same element
shared state across mounts. Now edit:<id> / new:<selector>.
Plus:
- Unsent drafts persist across chip / element switches via a ref-backed
Map keyed by bubbleKey. Cleared on successful submit; explicit close
deliberately preserves so users can resume.
- CommentChipBar's Apply button now toasts "onboardingIncomplete" when
config isn't ready, instead of letting sendPrompt silently early-return.1 parent 680709b commit b52e321
4 files changed
Lines changed: 105 additions & 18 deletions
File tree
- apps/desktop/src/renderer/src
- components
- chat
- comment
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
296 | 296 | | |
297 | 297 | | |
298 | 298 | | |
299 | | - | |
| 299 | + | |
300 | 300 | | |
301 | 301 | | |
302 | 302 | | |
| |||
305 | 305 | | |
306 | 306 | | |
307 | 307 | | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
308 | 313 | | |
309 | 314 | | |
310 | 315 | | |
| |||
551 | 556 | | |
552 | 557 | | |
553 | 558 | | |
| 559 | + | |
| 560 | + | |
| 561 | + | |
| 562 | + | |
| 563 | + | |
| 564 | + | |
| 565 | + | |
| 566 | + | |
| 567 | + | |
| 568 | + | |
554 | 569 | | |
555 | 570 | | |
556 | | - | |
| 571 | + | |
557 | 572 | | |
558 | 573 | | |
559 | 574 | | |
560 | 575 | | |
561 | | - | |
562 | | - | |
563 | | - | |
| 576 | + | |
| 577 | + | |
| 578 | + | |
| 579 | + | |
| 580 | + | |
564 | 581 | | |
565 | 582 | | |
566 | 583 | | |
| |||
573 | 590 | | |
574 | 591 | | |
575 | 592 | | |
576 | | - | |
| 593 | + | |
577 | 594 | | |
578 | 595 | | |
579 | 596 | | |
580 | 597 | | |
581 | 598 | | |
582 | 599 | | |
583 | 600 | | |
| 601 | + | |
584 | 602 | | |
585 | 603 | | |
586 | 604 | | |
587 | 605 | | |
| 606 | + | |
| 607 | + | |
| 608 | + | |
| 609 | + | |
| 610 | + | |
| 611 | + | |
| 612 | + | |
588 | 613 | | |
589 | 614 | | |
590 | 615 | | |
| |||
Lines changed: 20 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
| 22 | + | |
| 23 | + | |
22 | 24 | | |
23 | 25 | | |
24 | 26 | | |
25 | 27 | | |
26 | 28 | | |
27 | 29 | | |
28 | 30 | | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
29 | 48 | | |
30 | 49 | | |
31 | 50 | | |
| |||
77 | 96 | | |
78 | 97 | | |
79 | 98 | | |
80 | | - | |
| 99 | + | |
81 | 100 | | |
82 | 101 | | |
83 | 102 | | |
| |||
Lines changed: 13 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
12 | 16 | | |
13 | 17 | | |
14 | 18 | | |
| |||
30 | 34 | | |
31 | 35 | | |
32 | 36 | | |
| 37 | + | |
33 | 38 | | |
34 | 39 | | |
35 | 40 | | |
| |||
45 | 50 | | |
46 | 51 | | |
47 | 52 | | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
48 | 58 | | |
49 | 59 | | |
50 | 60 | | |
51 | | - | |
52 | | - | |
53 | | - | |
54 | | - | |
55 | | - | |
56 | 61 | | |
57 | | - | |
58 | 62 | | |
59 | 63 | | |
60 | | - | |
61 | 64 | | |
62 | 65 | | |
63 | 66 | | |
| |||
119 | 122 | | |
120 | 123 | | |
121 | 124 | | |
122 | | - | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
123 | 128 | | |
124 | 129 | | |
125 | 130 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
294 | 294 | | |
295 | 295 | | |
296 | 296 | | |
297 | | - | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
298 | 313 | | |
299 | 314 | | |
300 | 315 | | |
| |||
2073 | 2088 | | |
2074 | 2089 | | |
2075 | 2090 | | |
2076 | | - | |
| 2091 | + | |
2077 | 2092 | | |
2078 | 2093 | | |
2079 | | - | |
| 2094 | + | |
2080 | 2095 | | |
2081 | 2096 | | |
2082 | 2097 | | |
| 2098 | + | |
2083 | 2099 | | |
2084 | 2100 | | |
2085 | 2101 | | |
2086 | 2102 | | |
2087 | 2103 | | |
2088 | 2104 | | |
2089 | 2105 | | |
| 2106 | + | |
2090 | 2107 | | |
2091 | 2108 | | |
2092 | 2109 | | |
| 2110 | + | |
| 2111 | + | |
| 2112 | + | |
| 2113 | + | |
| 2114 | + | |
| 2115 | + | |
| 2116 | + | |
| 2117 | + | |
| 2118 | + | |
| 2119 | + | |
| 2120 | + | |
| 2121 | + | |
| 2122 | + | |
| 2123 | + | |
| 2124 | + | |
| 2125 | + | |
| 2126 | + | |
| 2127 | + | |
| 2128 | + | |
| 2129 | + | |
| 2130 | + | |
2093 | 2131 | | |
2094 | 2132 | | |
2095 | 2133 | | |
| |||
0 commit comments