Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
tbrandaws committed Aug 26, 2024
1 parent 0de904d commit 812d363
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 24 deletions.
4 changes: 2 additions & 2 deletions browser-extension/src/app/features/settings/useSettings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ const useSettings = () => {
throw new Error(`${key}は、string型で入力してください`);
}
}
})
}),
);
}, []);

Expand Down Expand Up @@ -120,7 +120,7 @@ const useSettings = () => {
!!settings.lambdaArn &&
!!settings.userPoolClientId &&
!!settings.userPoolId &&
!!settings.region
!!settings.region,
);
window.location.reload();
} else {
Expand Down
22 changes: 10 additions & 12 deletions browser-extension/src/index.html
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
<!doctype html>
<html lang="ja">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
</head>

<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
</head>

<body style="background-color: #232f3e">
<div id="root"></div>
<script src="./index.tsx" type="module"></script>
</body>

</html>
<body style="background-color: #232f3e">
<div id="root"></div>
<script src="./index.tsx" type="module"></script>
</body>
</html>
2 changes: 1 addition & 1 deletion browser-extension/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ proxyStore.ready().then(() => {
<SSOPage />
</Authenticator.Provider>
</Provider>
</React.StrictMode>
</React.StrictMode>,
);
});
2 changes: 1 addition & 1 deletion browser-extension/src/pages/chat/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@ proxyStore.ready().then(() => {
</DndProvider>
</Authenticator.Provider>
</Provider>
</React.StrictMode>
</React.StrictMode>,
);
});
18 changes: 10 additions & 8 deletions packages/web/src/hooks/useChatList.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { ListChatsResponse, Chat } from 'generative-ai-use-cases-jp';

const useChatList = () => {
const { listChats, deleteChat: deleteChatApi, updateTitle } = useChatApi();
const { data, size, setSize, isLoading, mutate } = listChats();
const { data, size, setSize, mutate } = listChats();

const chats = useMemo(() => {
if (data) {
Expand All @@ -15,14 +15,16 @@ const useChatList = () => {
}
}, [data]);

const isLoadingMore = useMemo(() => {
return (
isLoading || (size > 0 && data && typeof data[size - 1] === 'undefined')
);
}, [isLoading, size, data]);
const isLoading = useMemo(() => {
if (!data) return false;
return data!.length < size || data![size - 1] === undefined;
}, [data, size]);

const canLoadMore = useMemo(() => {
return !data || data!.length === size;
// チャットリストは 1 度に最大で 100 件取得される
return (
!data || (data!.length === size && data![size - 1].chats.length === 100)
);
}, [data, size]);

const loadMore = useCallback(() => {
Expand Down Expand Up @@ -93,7 +95,7 @@ const useChatList = () => {
};

return {
loading: isLoadingMore,
loading: isLoading,
chats,
mutate,
updateChatTitle,
Expand Down

0 comments on commit 812d363

Please sign in to comment.