From de9578ccc06dba8c5ac3e094461ddccf66b7103a Mon Sep 17 00:00:00 2001 From: Josh Chung Date: Wed, 26 Nov 2025 01:06:47 -0500 Subject: [PATCH 1/4] Fixed an endless loop. This happens in 2 situations when the bottom of scrolling is reached and we want to load more: 1- When the selected tab gets changed during loading. 2- When there are no more results to load and the end has been reached. --- lib/src/components/tab_view.dart | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/src/components/tab_view.dart b/lib/src/components/tab_view.dart index ff6c536..a6a453e 100644 --- a/lib/src/components/tab_view.dart +++ b/lib/src/components/tab_view.dart @@ -271,6 +271,11 @@ class _TenorTabViewState extends State // Wait for a frame so that we can ensure that `scrollController` is attached WidgetsBinding.instance.addPostFrameCallback((_) async { while (_scrollController.position.extentAfter == 0) { + // Stop trying to load more and exit the loop if: + // 1 - the selected tab has changed + // 2 - there are no more gifs to load + if (_tabProvider.selectedTab != tab || !_hasMoreGifs) return; + await _loadMore(); } }); From b5a28913e1c5a4faa7693af604ce079353e7492b Mon Sep 17 00:00:00 2001 From: Josh Chung Date: Wed, 26 Nov 2025 01:18:49 -0500 Subject: [PATCH 2/4] changelog --- CHANGELOG.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2ab4ae7..ddb029b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,10 +1,16 @@ +## 0.1.1 + +- fix: App freezes and crashes due to an endless loop. This happens when a different tab is selected during loading or when we reach the end of the results so there's no more loading needed. + +[All Code Changes](https://github.com/Flyclops/tenor_flutter/compare/0.1.0...0.1.1) + ## 0.1.0 - feat: Integrate [tenor_dart's](https://pub.dev/packages/tenor_dart) new `TenorResult.source` parameter to track which tab the GIF was selected from for analytics - fix: not being able to scroll down to load more on tablets or when using display zoom on iPad - refactor: `TenorViewEmojis`, `TenorViewGifs`, `TenorViewStickers` and `TenorTabView` now have a `gifsPerRow` parameter instead of `mediaWidth` to be more explicit and support a wider range of devices -[All Code Changes](https://github.com/Flyclops/tenor_flutter/compare/0.0.5...0.0.6) +[All Code Changes](https://github.com/Flyclops/tenor_flutter/compare/0.0.5...0.1.0) ## 0.0.5 From c16cd488edeefb7acf13480a29f91488b4325fb0 Mon Sep 17 00:00:00 2001 From: Josh Chung Date: Wed, 26 Nov 2025 01:21:33 -0500 Subject: [PATCH 3/4] updated version --- pubspec.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pubspec.yaml b/pubspec.yaml index 98380c6..03e4c08 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,5 +1,5 @@ name: tenor_flutter -version: 0.1.0 +version: 0.1.1 description: An opinionated yet customizable Flutter package for searching and selecting from a list of GIFs/Stickers from the Tenor GIF search API. homepage: https://github.com/flyclops repository: https://github.com/flyclops/tenor_flutter From dd75804d349ceebc3e9d74ca7d38ff6d4cb63dec Mon Sep 17 00:00:00 2001 From: Alex Fernandez Date: Thu, 27 Nov 2025 14:48:34 -0500 Subject: [PATCH 4/4] update changelog --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ddb029b..aa5cc93 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ ## 0.1.1 -- fix: App freezes and crashes due to an endless loop. This happens when a different tab is selected during loading or when we reach the end of the results so there's no more loading needed. +- fix: if you switch tabs very quickly before the initial gif fetch then you will get stuck in an endless loop and crash the app. [All Code Changes](https://github.com/Flyclops/tenor_flutter/compare/0.1.0...0.1.1)