Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(web): an unsaved citation comment survives a provider question #13336

ClosedMnigos(GitHub profile, opens in a new tab)wants to merge 9 commits intomain fromrefs/pull/13336/headopened View on GitHub

Showing 8 changed files with 96 additions and 8 deletions (loading 5).

x
0 of 8 viewed, 8 left
67 additions and 2 deletionsapps/web/src/components/chat/AssistantCitationChip.test.tsxModified
View file
@@ -51,14 +51,20 @@
​
let renderer: ReactTestRenderer;
​
-function mount(onSave = vi.fn(() => true)) {
+function mount(onSave = vi.fn(() => true), draftKey?: string) {
function Composer() {
const [open, setOpen] = useState(true);
return (
<AssistantCitationChip
citation={citation}
composer
- commentEditor={{ open, sourceAnchor, onOpenChange: setOpen, onSave }}
+ commentEditor={{
+ open,
+ sourceAnchor,
+ onOpenChange: setOpen,
+ onSave,
+ ...(draftKey === undefined ? {} : { draftKey }),
+ }}
/>
);
@@ -97,6 +103,65 @@
vi.unstubAllGlobals();
});
​
+describe("citation comment draft across a remount", () => {
+ it("resumes an unsaved comment when the chip is mounted again", () => {