Skip to content

An open-source remote desktop application designed for self-hosting, as an alternative to TeamViewer.

add comemnt

fufesoude356304c7e4
diff --git a/flutter/lib/common/widgets/peers_view.dart b/flutter/lib/common/widgets/peers_view.dart
index ed5f95d41..b10fe3e7d 100644
--- a/flutter/lib/common/widgets/peers_view.dart
+++ b/flutter/lib/common/widgets/peers_view.dart
@@ -190,7 +190,13 @@ class _PeersViewState extends State<_PeersView> with WindowListener {
child: widget.peerCardBuilder(peer),
);
final windowWidth = MediaQuery.of(context).size.width;
- final currentTab = gFFI.peerTabModel.currentTab;
+ // `Provider.of<PeerTabModel>(context)` will causes infinete loop.
+ // Because `gFFI.peerTabModel.setCurrentTabCachedPeers(peers)` will trigger `notifyListeners()`.
+ //
+ // No need to listen the currentTab change event.
+ // Because the currentTab change event will trigger the peers change event,
+ // and the peers change event will trigger _buildPeersView().
+ final currentTab = Provider.of<PeerTabModel>(context, listen: false).currentTab;
final hideAbTagsPanel = bind.mainGetLocalOption(key: "hideAbTagsPanel").isNotEmpty;
return isDesktop
? Obx(