From 64ab30b0a9c1e3454758cb76f86375a59a43c95b Mon Sep 17 00:00:00 2001 From: LittleSheep Date: Sun, 30 Nov 2025 17:25:16 +0800 Subject: [PATCH] :bug: Fix websocket didn't connect after logged out --- lib/screens/account.dart | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/screens/account.dart b/lib/screens/account.dart index 8dae1b04..97194494 100644 --- a/lib/screens/account.dart +++ b/lib/screens/account.dart @@ -6,6 +6,7 @@ import 'package:hooks_riverpod/hooks_riverpod.dart'; import 'package:island/pods/message.dart'; import 'package:island/pods/network.dart'; import 'package:island/pods/userinfo.dart'; +import 'package:island/pods/websocket.dart'; import 'package:island/screens/notification.dart'; import 'package:island/services/responsive.dart'; import 'package:island/widgets/account/account_name.dart'; @@ -468,6 +469,7 @@ class AccountScreen extends HookConsumerWidget { contentPadding: EdgeInsets.symmetric(horizontal: 24), title: Text('logout').tr(), onTap: () async { + final ws = ref.watch(websocketStateProvider.notifier); final apiClient = ref.watch(apiClientProvider); showLoadingModal(context); await apiClient.delete('/pass/accounts/me/sessions/current'); @@ -476,6 +478,7 @@ class AccountScreen extends HookConsumerWidget { hideLoadingModal(context); final userNotifier = ref.read(userInfoProvider.notifier); userNotifier.logOut(); + ws.close(); }, ), ],