From 59983ed1b3e1a8740d89dbb543b4e919adc5c4b3 Mon Sep 17 00:00:00 2001 From: mrleo1nid <43583385+mrleo1nid@users.noreply.github.com> Date: Sat, 24 Oct 2026 02:16:00 +0300 Subject: [PATCH] fix(social): complete shared listening request lifecycle --- apps/mobile/src/features/social/Listening.tsx | 2 +- apps/web/e2e/listening.spec.ts | 49 ++++++++++++++ apps/web/src/App.test.tsx | 67 +++++++++++++++++++ apps/web/src/features/social/Listening.tsx | 2 +- apps/web/src/player/listening.test.ts | 2 +- apps/web/src/test/e2eBridge.ts | 17 ++++- apps/web/src/test/fakeApi.ts | 7 +- docs/social.md | 8 +++ packages/core/src/listening.test.ts | 44 ++++++++++++ packages/core/src/listening.ts | 41 ++++++++++-- packages/i18n/locales/en/errors.json | 1 + packages/i18n/locales/ru/errors.json | 1 + .../social/features_integration_test.go | 57 ++++++++++++++++ services/api/internal/social/listening.go | 22 ++++-- 14 files changed, 302 insertions(+), 18 deletions(-) create mode 100644 apps/web/e2e/listening.spec.ts diff --git a/apps/mobile/src/features/social/Listening.tsx b/apps/mobile/src/features/social/Listening.tsx index e15f650..fee0947 100644 --- a/apps/mobile/src/features/social/Listening.tsx +++ b/apps/mobile/src/features/social/Listening.tsx @@ -38,7 +38,7 @@ export function ListenTogetherButton({ person }: { person: SocialPerson }) { function TogetherSheet({ person, close }: { person: SocialPerson; close: () => void }) { const { t } = useTranslation(); const { api, key } = useListening(); const cache = useQueryClient(); const state = usePlayerState(); const errorText = useErrorText(); const [kind, setKind] = useState<'join' | 'invite'>(person.activity ? 'join' : 'invite'); const [id] = useState(() => eventId(Date.now())); - const action = useMutation({ mutationFn: () => api.listeningAction({ id, action: kind, target_id: person.id }), onSuccess: async () => { await cache.invalidateQueries({ queryKey: key }); } }); + const action = useMutation({ mutationFn: () => api.listeningAction({ id, action: kind, target_id: person.id }), onSuccess: () => { close(); void cache.invalidateQueries({ queryKey: key }); } }); return