fix: refetch contacts after hiding inbox, redirect to most recent chat
After hiding a contact inbox, the contacts list now refetches immediately so the hidden contact disappears reactively. When the current contact is removed from the list, the selection jumps to the most recently active contact (by lastContactAt) instead of the first item in the current sort. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -19,7 +19,7 @@ export type ContactInbox = {
|
||||
updatedAt: string;
|
||||
};
|
||||
|
||||
export function useContactInboxes(opts: { apolloAuthReady: ComputedRef<boolean> }) {
|
||||
export function useContactInboxes(opts: { apolloAuthReady: ComputedRef<boolean>; onHidden?: () => void }) {
|
||||
const { result: contactInboxesResult, refetch: refetchContactInboxes } = useQuery(
|
||||
ContactInboxesQueryDocument,
|
||||
null,
|
||||
@@ -60,6 +60,7 @@ export function useContactInboxes(opts: { apolloAuthReady: ComputedRef<boolean>
|
||||
inboxToggleLoadingById.value = { ...inboxToggleLoadingById.value, [id]: true };
|
||||
try {
|
||||
await doSetContactInboxHidden({ inboxId: id, hidden });
|
||||
if (hidden && opts.onHidden) opts.onHidden();
|
||||
} catch (e: unknown) {
|
||||
console.error("[setInboxHidden] mutation failed:", e);
|
||||
} finally {
|
||||
|
||||
Reference in New Issue
Block a user