Skip to content

Commit

Permalink
🐞 fix(selectToSearch): rerender fix
Browse files Browse the repository at this point in the history
  • Loading branch information
summerscar committed Dec 18, 2024
1 parent 2ccb162 commit 17c91a7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion app/components/float-buttons-panel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ export function FloatButtonsPanel({
)}
</div>
),
[showAIPanel],
[showAIPanel, selectedText],
);

return createPortal(panel, document.body);
Expand Down
4 changes: 3 additions & 1 deletion app/hooks/use-select-to-search.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,12 @@ const useSelectToSearch = ({
? generateWordSuggestionPrompt
: prompt;

const selectedText = selection?.toString().trim() || "";

const panel = showPanel ? (
<FloatButtonsPanel
getRect={() => selection!.getRangeAt(0).getBoundingClientRect()}
selectedText={selection!.toString().trim()}
selectedText={selectedText}
showSearch={showSearch}
showCopy={showCopy}
showAI={showAI}
Expand Down

0 comments on commit 17c91a7

Please sign in to comment.