Fix profile agent huddle routing

This commit is contained in:
klopez4212
2026-06-30 13:55:23 +01:00
parent c2132dd7b3
commit 51cc6be16d
2 changed files with 3 additions and 4 deletions
@@ -274,7 +274,6 @@ export function useAnchoredScroll({
// Reset everything when the route's scroll identity changes — the layout
// effect that runs immediately after this reset is responsible for either
// jumping to bottom or to the target message for the new view.
// biome-ignore lint/correctness/useExhaustiveDependencies: resetKey is intentionally the sole trigger — it includes channel identity plus route-specific layout state.
React.useLayoutEffect(() => {
messagesRef.current = messages;
}, [messages]);
@@ -289,6 +288,7 @@ export function useAnchoredScroll({
}
}, [isHistoryPrependPending, scrollContainerRef]);
// biome-ignore lint/correctness/useExhaustiveDependencies: resetKey is intentionally the sole trigger — it includes channel identity plus route-specific layout state.
React.useLayoutEffect(() => {
anchorRef.current = { kind: "at-bottom" };
setIsAtBottom(true);
@@ -598,7 +598,6 @@ export function useAnchoredScroll({
// ---------------------------------------------------------------------------
// biome-ignore lint/correctness/useExhaustiveDependencies: resetKey is a deliberate re-subscription trigger — the effect body reads only the stable refs, but on route identity changes the keyed scroll container remounts and contentRef.current becomes a fresh node, so the observer must disconnect from the previous route's detached node and re-observe the live one.
React.useEffect(() => {
void scrollScopeKey;
const content = contentRef.current;
if (!content || typeof ResizeObserver === "undefined") return;
const observer = new ResizeObserver(() => {
@@ -348,7 +348,7 @@ export function UserProfilePopover({
try {
const dm = await openDmMutation.mutateAsync({ pubkeys: [pubkey] });
await goChannel(dm.id);
await startHuddle(dm.id, isBotProfile ? [pubkey] : []);
await startHuddle(dm.id, isAgentTarget ? [pubkey] : []);
await queryClient.invalidateQueries({ queryKey: channelsQueryKey });
if (isMountedRef.current) {
setOpen(false);
@@ -366,7 +366,7 @@ export function UserProfilePopover({
clearHoverTimer,
goChannel,
isAgentClassificationPending,
isBotProfile,
isAgentTarget,
isStartingHuddle,
openDmMutation,
pendingAction,