firebase / FirebaseUI-Flutter

Apache License 2.0
92 stars 79 forks source link

🐛 `FirestoreQueryBuilder` shows out-of-order and duplicate items #220

Closed wjkoh closed 5 months ago

wjkoh commented 6 months ago

Is there an existing issue for this?

What plugin is this bug for?

Firebase UI Firestore

What platform(s) does this bug affect?

Web

List of dependencies used.

flutter pub deps -s list ``` Dart SDK 3.2.3 Flutter SDK 3.16.4 bake_app 1.0.0+1 dependencies: - flutter 0.0.0 - characters 1.3.0 - collection 1.18.0 - material_color_utilities 0.5.0 - meta 1.10.0 - vector_math 2.1.4 - web 0.3.0 - sky_engine any - cupertino_icons 1.0.6 - provider 6.1.1 - collection ^1.15.0 - flutter any - nested ^1.0.0 - http 1.1.2 - async ^2.5.0 - http_parser ^4.0.0 - meta ^1.3.0 - web >=0.3.0 <0.5.0 - get_it 7.6.4 - async ^2.11.0 - collection ^1.17.1 - timeago 3.6.0 - intl ^0.18.0 - intl 0.18.1 - clock ^1.1.0 - meta ^1.0.2 - path ^1.8.0 - transparent_image 2.0.1 - device_preview 1.1.0 - flutter any - flutter_localizations any - provider ^6.0.1 - device_frame ^1.1.0 - freezed_annotation ^2.0.3 - json_annotation ^4.4.0 - shared_preferences ^2.0.9 - collection ^1.15.0 - go_router 12.1.3 - collection ^1.15.0 - flutter any - flutter_web_plugins any - logging ^1.0.0 - meta ^1.7.0 - url_launcher 6.2.2 - flutter any - url_launcher_android ^6.2.0 - url_launcher_ios ^6.2.0 - url_launcher_linux ^3.1.0 - url_launcher_macos ^3.1.0 - url_launcher_platform_interface ^2.2.0 - url_launcher_web ^2.2.0 - url_launcher_windows ^3.1.0 - unique_name_generator 1.0.0 - shared_preferences 2.2.2 - flutter any - shared_preferences_android ^2.1.0 - shared_preferences_foundation ^2.2.0 - shared_preferences_linux ^2.2.0 - shared_preferences_platform_interface ^2.3.0 - shared_preferences_web ^2.1.0 - shared_preferences_windows ^2.2.0 - firebase_analytics 10.7.4 - firebase_analytics_platform_interface ^3.8.4 - firebase_analytics_web ^0.5.5+11 - firebase_core ^2.24.2 - firebase_core_platform_interface ^5.0.0 - flutter any - logging 1.2.0 - firebase_core 2.24.2 - firebase_core_platform_interface ^5.0.0 - firebase_core_web ^2.10.0 - flutter any - meta ^1.8.0 - cloud_firestore 4.13.6 - cloud_firestore_platform_interface ^6.0.10 - cloud_firestore_web ^3.8.10 - collection ^1.0.0 - firebase_core ^2.24.2 - firebase_core_platform_interface ^5.0.0 - flutter any - meta ^1.8.0 - path 1.8.3 - share_plus 7.2.1 - cross_file ^0.3.3+4 - meta ^1.8.0 - mime ^1.0.4 - flutter any - flutter_web_plugins any - share_plus_platform_interface ^3.3.1 - file >=6.1.4 <8.0.0 - url_launcher_web ^2.0.16 - url_launcher_windows ^3.0.6 - url_launcher_linux ^3.0.5 - url_launcher_platform_interface ^2.1.2 - ffi ^2.0.1 - win32 >=4.0.0 <6.0.0 - file_selector 1.0.1 - file_selector_android ^0.5.0 - file_selector_ios ^0.5.0 - file_selector_linux ^0.9.2 - file_selector_macos ^0.9.3 - file_selector_platform_interface ^2.6.0 - file_selector_web ^0.9.1 - file_selector_windows ^0.9.3 - flutter any - firebase_storage 11.5.6 - firebase_core ^2.24.2 - firebase_core_platform_interface ^5.0.0 - firebase_storage_platform_interface ^5.1.3 - firebase_storage_web ^3.6.17 - flutter any - quiver 3.2.1 - matcher ^0.12.10 - feedback 3.0.0 - flutter any - flutter_localizations any - firebase_auth 4.15.3 - firebase_auth_platform_interface ^7.0.9 - firebase_auth_web ^5.8.12 - firebase_core ^2.24.2 - firebase_core_platform_interface ^5.0.0 - flutter any - meta ^1.8.0 - firebase_ui_auth 1.11.0 - email_validator ^2.1.17 - firebase_auth ^4.15.0 - firebase_core ^2.24.0 - firebase_dynamic_links ^5.4.6 - firebase_ui_localizations ^1.9.0 - firebase_ui_oauth ^1.4.15 - firebase_ui_shared ^1.4.1 - flutter any - flutter_localizations any - meta ^1.10.0 - firebase_ui_oauth_google 1.2.15 - firebase_auth ^4.15.0 - firebase_ui_oauth ^1.4.15 - flutter any - google_sign_in ^6.1.6 - wiredash 1.8.1 - async ^2.0.0 - clock ^1.1.0 - collection >=1.15.0 <2.0.0 - device_info_plus >=8.0.0 <10.0.0 - file >=6.0.0 <8.0.0 - flutter any - flutter_localizations any - http >=0.13.0 <2.0.0 - http_parser >=4.0.0 <5.0.0 - intl >=0.16.0 <2.0.0 - material_color_utilities >=0.1.2 <1.0.0 - nanoid2 ^2.0.1 - package_info_plus >=3.0.0 <6.0.0 - path_provider >=2.0.0 <3.0.0 - platform >=3.1.0 <5.0.0 - shared_preferences >=2.0.0 <3.0.0 - firebase_ui_firestore 1.5.15 - cloud_firestore ^4.13.3 - firebase_ui_localizations ^1.9.0 - flutter any dev dependencies: - flutter_test 0.0.0 - flutter any - test_api 0.6.1 - matcher 0.12.16 - path 1.8.3 - fake_async 1.3.1 - clock 1.1.1 - stack_trace 1.11.1 - vector_math 2.1.4 - async 2.11.0 - boolean_selector 2.1.1 - characters 1.3.0 - collection 1.18.0 - material_color_utilities 0.5.0 - meta 1.10.0 - source_span 1.10.0 - stream_channel 2.1.2 - string_scanner 1.2.0 - term_glyph 1.2.1 - web 0.3.0 - flutter_lints 3.0.1 - lints ^3.0.0 - test 1.24.9 - analyzer >=5.12.0 <7.0.0 - async ^2.5.0 - boolean_selector ^2.1.0 - collection ^1.15.0 - coverage ^1.0.1 - http_multi_server ^3.0.0 - io ^1.0.0 - js ^0.6.4 - matcher >=0.12.16 <0.12.17 - node_preamble ^2.0.0 - package_config ^2.0.0 - path ^1.8.0 - pool ^1.5.0 - shelf ^1.0.0 - shelf_packages_handler ^3.0.0 - shelf_static ^1.0.0 - shelf_web_socket ^1.0.0 - source_span ^1.8.0 - stack_trace ^1.10.0 - stream_channel ^2.1.0 - test_api 0.6.1 - test_core 0.5.9 - typed_data ^1.3.0 - web_socket_channel ^2.0.0 - webkit_inspection_protocol ^1.0.0 - yaml ^3.0.0 - mockito 5.4.4 - analyzer >=5.12.0 <7.0.0 - build ^2.0.0 - code_builder ^4.5.0 - collection ^1.15.0 - dart_style ^2.0.0 - matcher ^0.12.15 - meta ^1.3.0 - path ^1.8.0 - source_gen ^1.0.0 - test_api >=0.2.1 <0.8.0 - build_runner 2.4.7 - analyzer >=4.4.0 <7.0.0 - args ^2.0.0 - async ^2.5.0 - build >=2.1.0 <2.5.0 - build_config >=1.1.0 <1.2.0 - build_daemon ^4.0.0 - build_resolvers ^2.0.0 - build_runner_core ^7.2.0 - code_builder ^4.2.0 - collection ^1.15.0 - crypto ^3.0.0 - dart_style ^2.0.0 - frontend_server_client ^3.0.0 - glob ^2.0.0 - graphs ^2.2.0 - http_multi_server ^3.0.0 - io ^1.0.0 - js ^0.6.3 - logging ^1.0.0 - meta ^1.3.0 - mime ^1.0.0 - package_config ^2.0.0 - path ^1.8.0 - pool ^1.5.0 - pub_semver ^2.0.0 - pubspec_parse ^1.0.0 - shelf ^1.0.0 - shelf_web_socket ^1.0.0 - stack_trace ^1.10.0 - stream_transform ^2.0.0 - timing ^1.0.0 - watcher ^1.0.0 - web_socket_channel ^2.0.0 - yaml ^3.0.0 transitive dependencies: - _fe_analyzer_shared 64.0.0 - meta ^1.9.0 - _flutterfire_internals 1.3.16 - collection ^1.0.0 - firebase_core ^2.24.2 - firebase_core_platform_interface ^5.0.0 - flutter any - meta ^1.8.0 - analyzer 6.2.0 - _fe_analyzer_shared ^64.0.0 - collection ^1.17.0 - convert ^3.0.0 - crypto ^3.0.0 - glob ^2.0.0 - meta ^1.7.0 - package_config ^2.0.0 - path ^1.8.0 - pub_semver ^2.0.0 - source_span ^1.8.0 - watcher ^1.0.0 - yaml ^3.0.0 - args 2.4.2 - async 2.11.0 - collection ^1.15.0 - meta ^1.1.7 - boolean_selector 2.1.1 - source_span ^1.8.0 - string_scanner ^1.1.0 - build 2.4.1 - analyzer >=1.5.0 <7.0.0 - async ^2.5.0 - convert ^3.0.0 - crypto ^3.0.0 - glob ^2.0.0 - logging ^1.0.0 - meta ^1.3.0 - package_config ^2.1.0 - path ^1.8.0 - build_config 1.1.1 - checked_yaml ^2.0.0 - json_annotation ^4.5.0 - path ^1.8.0 - pubspec_parse ^1.0.0 - yaml ^3.0.0 - build_daemon 4.0.1 - built_collection ^5.0.0 - built_value ^8.1.0 - crypto ^3.0.3 - http_multi_server ^3.0.0 - logging ^1.0.0 - path ^1.8.0 - pool ^1.5.0 - shelf ^1.0.0 - shelf_web_socket ^1.0.0 - stream_transform ^2.0.0 - watcher ^1.0.0 - web_socket_channel ^2.0.0 - build_resolvers 2.4.2 - analyzer >=5.12.0 <7.0.0 - async ^2.5.0 - build ^2.0.0 - collection ^1.17.0 - convert ^3.1.1 - crypto ^3.0.0 - graphs >=1.0.0 <3.0.0 - logging ^1.0.0 - package_config ^2.0.0 - path ^1.8.0 - pool ^1.5.0 - pub_semver ^2.0.0 - stream_transform ^2.0.0 - yaml ^3.0.0 - build_runner_core 7.2.11 - async ^2.5.0 - build ^2.4.0 - build_config ^1.0.0 - build_resolvers ^2.4.0 - collection ^1.15.0 - convert ^3.0.0 - crypto ^3.0.0 - glob ^2.0.0 - graphs ^2.0.0 - json_annotation ^4.8.1 - logging ^1.2.0 - meta ^1.3.0 - package_config ^2.0.0 - path ^1.8.0 - pool ^1.5.0 - timing ^1.0.0 - watcher ^1.0.0 - yaml ^3.0.0 - built_collection 5.1.1 - built_value 8.8.1 - built_collection ^5.0.0 - collection ^1.15.0 - fixnum ^1.0.0 - meta ^1.3.0 - characters 1.3.0 - checked_yaml 2.0.3 - json_annotation ^4.3.0 - source_span ^1.8.0 - yaml ^3.0.0 - clock 1.1.1 - cloud_firestore_platform_interface 6.0.10 - _flutterfire_internals ^1.3.16 - collection ^1.15.0 - firebase_core ^2.24.2 - flutter any - meta ^1.8.0 - plugin_platform_interface ^2.1.3 - cloud_firestore_web 3.8.10 - _flutterfire_internals ^1.3.16 - cloud_firestore_platform_interface ^6.0.10 - collection ^1.0.0 - firebase_core ^2.24.2 - firebase_core_web ^2.10.0 - flutter any - flutter_web_plugins any - js ^0.6.3 - code_builder 4.9.0 - built_collection ^5.0.0 - built_value ^8.0.0 - collection ^1.15.0 - matcher ^0.12.10 - meta ^1.3.0 - collection 1.18.0 - convert 3.1.1 - typed_data ^1.3.0 - coverage 1.7.2 - args ^2.0.0 - logging ^1.0.0 - package_config ^2.0.0 - path ^1.8.0 - source_maps ^0.10.10 - stack_trace ^1.10.0 - vm_service >=12.0.0 <15.0.0 - cross_file 0.3.3+8 - meta ^1.3.0 - web >=0.3.0 <0.5.0 - crypto 3.0.3 - typed_data ^1.3.0 - dart_style 2.3.4 - analyzer ^6.2.0 - args >=1.0.0 <3.0.0 - collection ^1.17.0 - path ^1.0.0 - pub_semver >=1.4.4 <3.0.0 - source_span ^1.4.0 - desktop_webview_auth 0.0.14 - crypto ^3.0.3 - flutter any - http ^1.0.0 - flutter_web_plugins any - plugin_platform_interface ^2.1.4 - device_frame 1.1.0 - freezed_annotation ^2.0.3 - flutter any - device_info_plus 9.1.1 - device_info_plus_platform_interface ^7.0.0 - ffi ^2.0.1 - file >=6.1.4 <8.0.0 - flutter any - flutter_web_plugins any - meta ^1.8.0 - win32 >=4.0.0 <6.0.0 - win32_registry ^1.1.0 - device_info_plus_platform_interface 7.0.0 - flutter any - meta ^1.3.0 - plugin_platform_interface ^2.0.0 - email_validator 2.1.17 - fake_async 1.3.1 - clock ^1.1.0 - collection ^1.15.0 - ffi 2.1.0 - file 7.0.0 - meta ^1.9.1 - path ^1.8.3 - file_selector_android 0.5.0+4 - file_selector_platform_interface ^2.5.0 - flutter any - plugin_platform_interface ^2.0.2 - file_selector_ios 0.5.1+7 - file_selector_platform_interface ^2.3.0 - flutter any - file_selector_linux 0.9.2+1 - cross_file ^0.3.1 - file_selector_platform_interface ^2.6.0 - flutter any - file_selector_macos 0.9.3+3 - cross_file ^0.3.1 - file_selector_platform_interface ^2.6.0 - flutter any - file_selector_platform_interface 2.6.1 - cross_file ^0.3.0 - flutter any - http >=0.13.0 <2.0.0 - plugin_platform_interface ^2.1.0 - file_selector_web 0.9.3 - file_selector_platform_interface ^2.6.0 - flutter any - flutter_web_plugins any - web >=0.3.0 <0.5.0 - file_selector_windows 0.9.3+1 - cross_file ^0.3.1 - file_selector_platform_interface ^2.6.0 - flutter any - firebase_analytics_platform_interface 3.8.4 - _flutterfire_internals ^1.3.16 - firebase_core ^2.24.2 - flutter any - meta ^1.8.0 - plugin_platform_interface ^2.1.3 - firebase_analytics_web 0.5.5+11 - _flutterfire_internals ^1.3.16 - firebase_analytics_platform_interface ^3.8.4 - firebase_core ^2.24.2 - firebase_core_web ^2.10.0 - flutter any - flutter_web_plugins any - js ^0.6.3 - firebase_auth_platform_interface 7.0.9 - _flutterfire_internals ^1.3.16 - collection ^1.16.0 - firebase_core ^2.24.2 - flutter any - meta ^1.8.0 - plugin_platform_interface ^2.1.3 - firebase_auth_web 5.8.12 - firebase_auth_platform_interface ^7.0.9 - firebase_core ^2.24.2 - firebase_core_web ^2.10.0 - flutter any - flutter_web_plugins any - http_parser ^4.0.0 - js ^0.6.3 - meta ^1.8.0 - firebase_core_platform_interface 5.0.0 - collection ^1.0.0 - flutter any - flutter_test any - meta ^1.8.0 - plugin_platform_interface ^2.1.3 - firebase_core_web 2.10.0 - firebase_core_platform_interface ^5.0.0 - flutter any - flutter_web_plugins any - js ^0.6.3 - meta ^1.8.0 - firebase_dynamic_links 5.4.8 - firebase_core ^2.24.2 - firebase_core_platform_interface ^5.0.0 - firebase_dynamic_links_platform_interface ^0.2.6+16 - flutter any - meta ^1.8.0 - plugin_platform_interface ^2.1.3 - firebase_dynamic_links_platform_interface 0.2.6+16 - _flutterfire_internals ^1.3.16 - firebase_core ^2.24.2 - flutter any - meta ^1.8.0 - plugin_platform_interface ^2.1.3 - firebase_storage_platform_interface 5.1.3 - _flutterfire_internals ^1.3.16 - collection ^1.15.0 - firebase_core ^2.24.2 - flutter any - meta ^1.8.0 - plugin_platform_interface ^2.1.3 - firebase_storage_web 3.6.17 - _flutterfire_internals ^1.3.16 - async ^2.5.0 - firebase_core ^2.24.2 - firebase_core_web ^2.10.0 - firebase_storage_platform_interface ^5.1.3 - flutter any - flutter_web_plugins any - http >=0.13.0 <2.0.0 - js ^0.6.3 - meta ^1.8.0 - firebase_ui_localizations 1.9.0 - flutter any - flutter_localizations any - path ^1.8.3 - firebase_ui_oauth 1.4.15 - desktop_webview_auth ^0.0.14 - firebase_auth ^4.15.0 - firebase_ui_auth ^1.11.0 - firebase_ui_shared ^1.4.1 - flutter_svg ^2.0.9 - flutter any - firebase_ui_shared 1.4.1 - flutter any - fixnum 1.1.0 - flutter_localizations 0.0.0 - flutter any - intl 0.18.1 - characters 1.3.0 - clock 1.1.1 - collection 1.18.0 - material_color_utilities 0.5.0 - meta 1.10.0 - path 1.8.3 - vector_math 2.1.4 - web 0.3.0 - flutter_svg 2.0.9 - flutter any - vector_graphics ^1.1.9+1 - vector_graphics_codec ^1.1.9+1 - vector_graphics_compiler ^1.1.9+1 - flutter_web_plugins 0.0.0 - flutter any - characters 1.3.0 - collection 1.18.0 - material_color_utilities 0.5.0 - meta 1.10.0 - vector_math 2.1.4 - web 0.3.0 - freezed_annotation 2.4.1 - collection ^1.15.0 - json_annotation ^4.6.0 - meta ^1.7.0 - frontend_server_client 3.2.0 - async ^2.5.0 - path ^1.8.0 - glob 2.1.2 - async ^2.5.0 - collection ^1.15.0 - file >=6.1.3 <8.0.0 - path ^1.8.0 - string_scanner ^1.1.0 - google_identity_services_web 0.3.0+2 - meta ^1.3.0 - web >=0.3.0 <0.5.0 - google_sign_in 6.2.1 - flutter any - google_sign_in_android ^6.1.0 - google_sign_in_ios ^5.7.0 - google_sign_in_platform_interface ^2.4.0 - google_sign_in_web ^0.12.0 - google_sign_in_android 6.1.20 - flutter any - google_sign_in_platform_interface ^2.2.0 - google_sign_in_ios 5.7.1 - flutter any - google_sign_in_platform_interface ^2.2.0 - google_sign_in_platform_interface 2.4.3 - flutter any - plugin_platform_interface ^2.1.0 - google_sign_in_web 0.12.3+1 - flutter any - flutter_web_plugins any - google_identity_services_web ^0.3.0 - google_sign_in_platform_interface ^2.4.0 - http >=0.13.0 <2.0.0 - web >=0.3.0 <0.5.0 - graphs 2.3.1 - collection ^1.1.0 - http_multi_server 3.2.1 - async ^2.5.0 - http_parser 4.0.2 - collection ^1.15.0 - source_span ^1.8.0 - string_scanner ^1.1.0 - typed_data ^1.3.0 - io 1.0.4 - meta ^1.3.0 - path ^1.8.0 - string_scanner ^1.1.0 - js 0.6.7 - meta ^1.7.0 - json_annotation 4.8.1 - meta ^1.4.0 - lints 3.0.0 - matcher 0.12.16 - async ^2.10.0 - meta ^1.8.0 - stack_trace ^1.10.0 - term_glyph ^1.2.0 - test_api >=0.5.0 <0.7.0 - material_color_utilities 0.5.0 - collection ^1.15.0 - meta 1.10.0 - mime 1.0.4 - nanoid2 2.0.1 - nested 1.0.0 - flutter any - node_preamble 2.0.2 - package_config 2.1.0 - path ^1.8.0 - package_info_plus 5.0.1 - ffi ^2.0.1 - flutter any - flutter_web_plugins any - http >=0.13.5 <2.0.0 - meta ^1.8.0 - path ^1.8.2 - package_info_plus_platform_interface ^2.0.1 - web >=0.3.0 <0.5.0 - win32 >=4.0.0 <6.0.0 - package_info_plus_platform_interface 2.0.1 - flutter any - meta ^1.3.0 - plugin_platform_interface ^2.0.0 - path_parsing 1.0.1 - vector_math ^2.1.0 - meta ^1.3.0 - path_provider 2.1.1 - flutter any - path_provider_android ^2.1.0 - path_provider_foundation ^2.3.0 - path_provider_linux ^2.2.0 - path_provider_platform_interface ^2.1.0 - path_provider_windows ^2.2.0 - path_provider_android 2.2.1 - flutter any - path_provider_platform_interface ^2.1.0 - path_provider_foundation 2.3.1 - flutter any - path_provider_platform_interface ^2.1.0 - path_provider_linux 2.2.1 - ffi >=1.1.2 <3.0.0 - flutter any - path ^1.8.0 - path_provider_platform_interface ^2.1.0 - xdg_directories >=0.2.0 <2.0.0 - path_provider_platform_interface 2.1.1 - flutter any - platform ^3.0.0 - plugin_platform_interface ^2.1.0 - path_provider_windows 2.2.1 - ffi ^2.0.0 - flutter any - path ^1.8.0 - path_provider_platform_interface ^2.1.0 - win32 >=2.1.0 <6.0.0 - petitparser 6.0.2 - meta ^1.9.0 - platform 3.1.3 - plugin_platform_interface 2.1.7 - meta ^1.3.0 - pool 1.5.1 - async ^2.5.0 - stack_trace ^1.10.0 - pub_semver 2.1.4 - collection ^1.15.0 - meta ^1.3.0 - pubspec_parse 1.2.3 - checked_yaml ^2.0.1 - collection ^1.15.0 - json_annotation ^4.8.0 - pub_semver ^2.0.0 - yaml ^3.0.0 - share_plus_platform_interface 3.3.1 - cross_file ^0.3.3+4 - flutter any - meta ^1.8.0 - mime ^1.0.4 - plugin_platform_interface ^2.1.4 - path_provider ^2.0.14 - uuid >=3.0.7 <5.0.0 - shared_preferences_android 2.2.1 - flutter any - shared_preferences_platform_interface ^2.3.0 - shared_preferences_foundation 2.3.4 - flutter any - shared_preferences_platform_interface ^2.3.0 - shared_preferences_linux 2.3.2 - file >=6.0.0 <8.0.0 - flutter any - path ^1.8.0 - path_provider_linux ^2.0.0 - path_provider_platform_interface ^2.0.0 - shared_preferences_platform_interface ^2.3.0 - shared_preferences_platform_interface 2.3.1 - flutter any - plugin_platform_interface ^2.1.0 - shared_preferences_web 2.2.2 - flutter any - flutter_web_plugins any - shared_preferences_platform_interface ^2.3.0 - web >=0.3.0 <0.5.0 - shared_preferences_windows 2.3.2 - file >=6.0.0 <8.0.0 - flutter any - path ^1.8.0 - path_provider_platform_interface ^2.0.0 - path_provider_windows ^2.0.0 - shared_preferences_platform_interface ^2.3.0 - shelf 1.4.1 - async ^2.5.0 - collection ^1.15.0 - http_parser ^4.0.0 - path ^1.8.0 - stack_trace ^1.10.0 - stream_channel ^2.1.0 - shelf_packages_handler 3.0.2 - path ^1.8.0 - shelf ^1.0.0 - shelf_static ^1.0.0 - shelf_static 1.1.2 - convert ^3.0.0 - http_parser ^4.0.0 - mime ^1.0.0 - path ^1.8.0 - shelf ^1.1.2 - shelf_web_socket 1.0.4 - shelf ^1.1.0 - stream_channel ^2.1.0 - web_socket_channel ^2.0.0 - sky_engine 0.0.99 - source_gen 1.5.0 - analyzer >=5.2.0 <7.0.0 - async ^2.5.0 - build ^2.1.0 - dart_style ^2.0.0 - glob ^2.0.0 - path ^1.8.0 - source_span ^1.8.0 - yaml ^3.0.0 - source_map_stack_trace 2.1.1 - path ^1.8.0 - source_maps ^0.10.10 - stack_trace ^1.10.0 - source_maps 0.10.12 - source_span ^1.8.0 - source_span 1.10.0 - collection ^1.15.0 - path ^1.8.0 - term_glyph ^1.2.0 - sprintf 7.0.0 - stack_trace 1.11.1 - path ^1.8.0 - stream_channel 2.1.2 - async ^2.5.0 - stream_transform 2.1.0 - string_scanner 1.2.0 - source_span ^1.8.0 - term_glyph 1.2.1 - test_api 0.6.1 - async ^2.5.0 - boolean_selector ^2.1.0 - collection ^1.15.0 - meta ^1.3.0 - source_span ^1.8.0 - stack_trace ^1.10.0 - stream_channel ^2.1.0 - string_scanner ^1.1.0 - term_glyph ^1.2.0 - test_core 0.5.9 - analyzer >=3.3.0 <7.0.0 - args ^2.0.0 - async ^2.5.0 - boolean_selector ^2.1.0 - collection ^1.15.0 - coverage ^1.0.0 - frontend_server_client >=3.2.0 <4.0.0 - glob ^2.0.0 - io ^1.0.0 - meta ^1.3.0 - package_config ^2.0.0 - path ^1.8.0 - pool ^1.5.0 - source_map_stack_trace ^2.1.0 - source_maps ^0.10.10 - source_span ^1.8.0 - stack_trace ^1.10.0 - stream_channel ^2.1.0 - test_api 0.6.1 - vm_service >=6.0.0 <14.0.0 - yaml ^3.0.0 - timing 1.0.1 - json_annotation ^4.3.0 - typed_data 1.3.2 - collection ^1.15.0 - url_launcher_android 6.2.0 - flutter any - url_launcher_platform_interface ^2.2.0 - url_launcher_ios 6.2.1 - flutter any - url_launcher_platform_interface ^2.2.0 - url_launcher_linux 3.1.1 - flutter any - url_launcher_platform_interface ^2.2.0 - url_launcher_macos 3.1.0 - flutter any - url_launcher_platform_interface ^2.2.0 - url_launcher_platform_interface 2.2.0 - flutter any - plugin_platform_interface ^2.1.0 - url_launcher_web 2.2.2 - flutter any - flutter_web_plugins any - url_launcher_platform_interface ^2.2.0 - web >=0.3.0 <0.5.0 - url_launcher_windows 3.1.1 - flutter any - url_launcher_platform_interface ^2.2.0 - uuid 4.2.2 - crypto ^3.0.0 - sprintf ^7.0.0 - meta ^1.9.1 - vector_graphics 1.1.9+1 - flutter any - vector_graphics_codec 1.1.9+1 - vector_graphics_codec 1.1.9+1 - vector_graphics_compiler 1.1.9+1 - args ^2.3.0 - meta ^1.7.0 - path_parsing ^1.0.1 - xml ^6.3.0 - vector_graphics_codec 1.1.9+1 - path ^1.8.0 - vector_math 2.1.4 - vm_service 13.0.0 - watcher 1.1.0 - async ^2.5.0 - path ^1.8.0 - web 0.3.0 - web_socket_channel 2.4.0 - async ^2.5.0 - crypto ^3.0.0 - stream_channel ^2.1.0 - webkit_inspection_protocol 1.2.1 - logging ^1.0.0 - win32 5.1.1 - ffi ^2.1.0 - win32_registry 1.1.2 - ffi ^2.1.0 - win32 ^5.0.7 - xdg_directories 1.0.3 - meta ^1.3.0 - path ^1.8.0 - xml 6.5.0 - collection ^1.18.0 - meta ^1.9.0 - petitparser ^6.0.0 - yaml 3.1.2 - collection ^1.15.0 - source_span ^1.8.0 - string_scanner ^1.1.0 ```

Steps to reproduce

  1. Create a query that contains .orderBy('some_timestamp_field') and .startAt([lastSynced]) as follows.

    final lastSynced = Timestamp.now();
    final query = FirebaseFirestore.instance
        .collection('posts')
        .orderBy('posted', descending: true)
        .startAt([lastSynced])
        .withConverter<PostModel>(
      fromFirestore: (snapshot, _) => PostModel.fromJson(snapshot.data()!),
      toFirestore: (post, _) => post.toJson(),
    );
  2. Give the query to FirestoreQueryBuilder as follows:

        FirestoreQueryBuilder<PostModel>(
          query: query,
          builder: (context, snapshot, _) {
            if (snapshot.isFetching) {
              return const CircularProgressIndicator();
            }
            if (snapshot.hasError) {
              return Text('Error ${snapshot.error}');
            }
            return GridView.builder(
              gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(
                crossAxisCount: 3,
                mainAxisSpacing: 1,
                crossAxisSpacing: 1,
              ),
              itemCount: snapshot.docs.length,
              itemBuilder: (context, index) {
                if (snapshot.hasMore && index + 1 == snapshot.docs.length) {
                  snapshot.fetchMore();
                }
                final post = snapshot.docs[index].data();
                if (index == 0) {
                  print(post.id);
                }
               return const Placeholder();
          },
      );

Expected Behavior

I expected that the print statement prints the latest document, which is closest to lastUpdated, whenever I create the widget. What I expected:

qQ3sxaAa1qDN9vLP034h
qQ3sxaAa1qDN9vLP034h
qQ3sxaAa1qDN9vLP034h
...

Actual Behavior

However, it sometimes prints a much older post. What I actually got:

qCnHmlWDHIEsEcSVYVWG
qQ3sxaAa1qDN9vLP034h
qCnHmlWDHIEsEcSVYVWG
qQ3sxaAa1qDN9vLP034h
...

The posted field value of qCnHmlWDHIEsEcSVYVWG is December 18, 2023 and that of qQ3sxaAa1qDN9vLP034h is December 21, 2023.

I think the startAt condition in my query is conflicting with the pagination logic of FirestoreQueryBuilder. Is there a way to replicate the same behavior without any issues? My aim was to stop the query from receiving any posts created after lastSynced automatically. This is because the posts collection is where every user can create a new post and I was concerned that the query might result in too many read operations if it constantly fetches new documents. I would like to prevent this and only update lastSynced and the resulting query manually when requested by the user.

Additional Information

No response

wjkoh commented 6 months ago

Actually, the issue persists even after I removed the startAt condition, making my guess invalid. It appears that FirestoreQueryBuilder is impacted by what the other ListView in another tab displayed previously, which is strange. If anyone has any thoughts on what might be causing this behavior, I would be grateful.

danagbemava-nc commented 6 months ago

Hi @wjkoh, thanks for filing this issue.

Please provide a complete minimal reproducible code sample in a repo that we can clone so that we can investigate this issue.

Also, have you tested on other platforms and what were the results if you did?

wjkoh commented 6 months ago

@danagbemava-nc thank you for having a look! I believe I have fixed the issue on my end. I am utilizing MVVM and am using a provider (ChangeNotifier) for the viewModel and I store a query in the viewModel which I update sporadically and let context.select() rebuild FirestoreQueryBuilder with a new query once the query has been updated. Please refer to the code below. After I removed the code that updates the query, making it static, FirestoreQueryBuilder worked without a hitch. In conclusion, I believe the issue is related to the asynchronous and frequent update of the query variable and rebuilding the widget somehow. If I have some time, I will create a minimal reproducible code, although it is not a priority for the moment.

  @override
  Widget build(BuildContext context) {
    final query = context.select((ExploreViewModel vm) => vm.query);
    return FirestoreQueryBuilder<PostModel>(
          query: query,
          builder: (context, snapshot, _) { ... }
wjkoh commented 6 months ago

I solved the problem on my end. The cause of the issue was two unexpected behaviors.

Firstly, FirestoreQueryBuilder does not always give you the correct items. For instance, if the page size is 10, you would anticipate getting [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] as your initial page items when your query and database are constant. Yet, the query builder appears to supply an out-of-order result of fewer items, like [5, 6, 7], occasionally, and then it immediately provides an update with the correct page items, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]. Thus, this behavior is usually tolerable, but not in my case due to the following bug.

Secondly, there was a bug in my code that violated one of the provider rules, "DO NOT create your provider from variables that can change over time." This resulted in my code not applying the FirestoreQueryBuilder updates, and kept displaying the first wrong set of items. I wrote the code this way since I did not expect the behavior I mentioned above.

In summary, it would be great if FirestoreQueryBuilder gave the right set of items constantly. Nevertheless, I was able to fix the issue on my end by constantly applying the updates from FirestoreQueryBuilder. I left this comment open in case you were curious to find out why the query builder initially provided an incorrect set of items. Feel free to close it if not. Thanks!

danagbemava-nc commented 6 months ago

Hi @wjkoh, was this only happening only on the web? It would help if you could provide a complete sample in a repo that we could clone so that we could investigate it fully.

wjkoh commented 5 months ago

Yes, I have only tested the web build and have not had the opportunity to test it in other releases due to our use of web-specific libraries. Unfortunately, I was unable to replicate this issue in my minimal reproducible code. It is possible that this could be an issue in other areas of our application, such as providers and multiple firestore snapshots. I will close this issue for now and revisit it if I gain any further insight. Thank you.