Skip to content

Commit

Permalink
fix: clear last height (#29)
Browse files Browse the repository at this point in the history
  • Loading branch information
RainyNight9 authored Nov 29, 2024
1 parent 2b848f0 commit bca7f91
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
13 changes: 10 additions & 3 deletions src/components/SearchChat/Search.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ function Search({ isTransitioned, isChatMode, input }: SearchProps) {
const resizeObserver = new ResizeObserver(async (entries) => {
for (let entry of entries) {
let newHeight = entry.contentRect.height;
newHeight = newHeight + 90 + (newHeight === 0 ? 0 : 46);
console.log("Height updated:", newHeight);
newHeight = newHeight + 90 + (newHeight === 0 ? 0 : 46);
await getCurrentWebviewWindow()?.setSize(
new LogicalSize(680, newHeight)
);
Expand All @@ -40,7 +40,7 @@ function Search({ isTransitioned, isChatMode, input }: SearchProps) {
return () => {
resizeObserver.disconnect();
};
}, []);
}, [suggests]);

const getSuggest = async () => {
try {
Expand All @@ -51,6 +51,13 @@ function Search({ isTransitioned, isChatMode, input }: SearchProps) {
console.log("_suggest", input, response);
const data = response.data?.hits?.hits || [];
setSuggests(data);
//
// const list = [];
// for (let i = 0; i < input.length; i++) {
// list.push({});
// }
// setSuggests(list);
//
setIsSearchComplete(true);
} catch (error) {
console.error("Failed to fetch user data:", error);
Expand All @@ -72,7 +79,7 @@ function Search({ isTransitioned, isChatMode, input }: SearchProps) {
if (!input) setSuggests([]);
}, [input]);

if (isChatMode || suggests.length === 0) return null;
// if (isChatMode || suggests.length === 0) return null;

return (
<div
Expand Down
4 changes: 1 addition & 3 deletions src/components/SearchChat/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,6 @@ export default function SearchChat() {
};
const isTyping = false;

console.log(11111, isChatMode, input, !input);

return (
<div
data-tauri-drag-region
Expand Down Expand Up @@ -132,7 +130,7 @@ export default function SearchChat() {
/>
</div>

{isChatMode || !input ? null : (
{isChatMode ? null : (
<Search
key="Search"
input={input}
Expand Down
2 changes: 0 additions & 2 deletions src/hooks/useAutoResizeWindow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ const useAutoResizeWindow = () => {

try {
// Resize the window to fit content size

console.log(121212, contentHeight)
await getCurrentWebviewWindow()?.setSize(
new LogicalSize(680, contentHeight)
);
Expand Down

0 comments on commit bca7f91

Please # to comment.