Skip to content

Commit cc42eb7

Browse files
morethanwordsclaude
andcommitted
Let the link preview be dismissed back to the reply plate
Quoting a message and then typing a link left the plate stuck on the web page: neither Escape, nor the cross, nor "Remove preview" could get rid of it. setTopInfo({type: 'webpage'}) only repaints the plate - helperType stays 'reply' - so onHelperCancel restores the previous helper by calling helperFunc(). But willSendWebPage was dropped only AFTER that call, and setTopInfo bails out early on `willSendWebPage && type === 'reply'`, so the reply was never repainted: the plate kept showing a preview that was already gone from the state. setCurrentHover got an undefined element along the way, which also killed the hover menu holding "Remove preview" - hence "stuck". Drop willSendWebPage before restoring the helper; lastUrl / noWebPage are still restored afterwards, since setTopInfo's clearHelper resets them. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
1 parent 1d0e373 commit cc42eb7

1 file changed

Lines changed: 8 additions & 7 deletions

File tree

‎src/components/chat/input.ts‎

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3988,19 +3988,20 @@ export default class ChatInput {
39883988

39893989
if(this.willSendWebPage) {
39903990
const lastUrl = this.lastUrl;
3991-
let needReturn = false;
3992-
if(this.helperType) {
3993-
// if(this.helperFunc) {
3994-
await this.helperFunc();
3995-
// }
3991+
const needReturn = !!this.helperType;
3992+
3993+
// * has to be dropped BEFORE restoring the previous helper, otherwise
3994+
// * setTopInfo would ignore it and the preview would stay in the plate
3995+
this.willSendWebPage = null;
39963996

3997-
needReturn = true;
3997+
if(needReturn) {
3998+
await this.helperFunc();
3999+
this.willSendWebPage = null; // * in case a new one has been fetched meanwhile
39984000
}
39994001

40004002
// * restore values
40014003
this.lastUrl = lastUrl;
40024004
this.noWebPage = true;
4003-
this.willSendWebPage = null;
40044005

40054006
if(needReturn) return;
40064007
}

0 commit comments

Comments
 (0)