feat: Enable direct navigation to specific message conversations via URL parameters and initiate new conversations from the network page.
This commit is contained in:
@@ -126,7 +126,7 @@ interface ConnectedAgent {
|
||||
state: string | null;
|
||||
}
|
||||
|
||||
export function MessagingPage() {
|
||||
export function MessagingPage({ initialConversationId }: { initialConversationId?: string | null }) {
|
||||
const { data: session } = useSession();
|
||||
const {
|
||||
conversations,
|
||||
@@ -298,6 +298,20 @@ export function MessagingPage() {
|
||||
}
|
||||
}, [conversations]);
|
||||
|
||||
// Auto-select conversation when navigated with initialConversationId
|
||||
const initialConvHandledRef = useRef(false);
|
||||
useEffect(() => {
|
||||
if (
|
||||
initialConversationId &&
|
||||
!initialConvHandledRef.current &&
|
||||
conversations.length > 0 &&
|
||||
!isLoading
|
||||
) {
|
||||
initialConvHandledRef.current = true;
|
||||
selectConversation(initialConversationId);
|
||||
}
|
||||
}, [initialConversationId, conversations, isLoading, selectConversation]);
|
||||
|
||||
// Convert current conversation avatar when selected
|
||||
useEffect(() => {
|
||||
const convertCurrentAvatar = async () => {
|
||||
|
||||
Reference in New Issue
Block a user