Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

会話履歴のページは header にタイトルを出すようにする #87

Merged
merged 3 commits into from
Oct 4, 2023

Conversation

tbrand
Copy link
Contributor

@tbrand tbrand commented Oct 4, 2023

#60

@tbrand tbrand requested a review from wadabee October 4, 2023 03:34
Comment on lines 90 to 98
useEffect(() => {
setLabel(getLabelByPath(pathname));
}, [pathname]);
const chatId = extractChatId(pathname);

if (chatId) {
setLabel(getConversationTitle(chatId) || '');
} else {
setLabel(items.find((i) => i.to === pathname)?.label || '');
}
}, [pathname, getConversationTitle]);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

以下のエラーが発生しているようです。
Labelを設定するだけの処理なので、useMemoでラベルを返す感じでもいいかなと思いました!

App.tsx:94 Warning: Maximum update depth exceeded. This can happen when a component calls setState inside useEffect, but useEffect either doesn't have a dependency array, or one of the dependencies changes on every render.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

修正しました!

@wadabee wadabee merged commit d0c2327 into main Oct 4, 2023
1 check passed
@wadabee wadabee deleted the chat-title branch October 4, 2023 04:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants