mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-16 16:30:15 +01:00
fix: Update query parameter handling in useChatHelpers
- Refactored the logic for determining the query parameter used in fetching messages to prioritize paramId from the URL, falling back to conversationId only if paramId is not available. This change ensures consistency with the ChatView component's expectations.
This commit is contained in:
parent
1853b4a189
commit
8018762f11
1 changed files with 4 additions and 2 deletions
|
|
@ -24,11 +24,13 @@ export default function useChatHelpers(index = 0, paramId?: string) {
|
|||
const { conversation, setConversation } = useCreateConversationAtom(index);
|
||||
const { conversationId, endpoint, endpointType } = conversation ?? {};
|
||||
|
||||
const queryParam = paramId === 'new' ? paramId : (conversationId ?? paramId ?? '');
|
||||
/** Use paramId (from URL) as primary source for query key - this must match what ChatView uses
|
||||
Falling back to conversationId (Recoil) only if paramId is not available */
|
||||
const queryParam = paramId === 'new' ? paramId : (paramId ?? conversationId ?? '');
|
||||
|
||||
/* Messages: here simply to fetch, don't export and use `getMessages()` instead */
|
||||
|
||||
const { data: _messages } = useGetMessagesByConvoId(conversationId ?? '', {
|
||||
const { data: _messages } = useGetMessagesByConvoId(queryParam, {
|
||||
enabled: isAuthenticated,
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue