flutterfire icon indicating copy to clipboard operation
flutterfire copied to clipboard

🐛 [firebase_database] Issue with onValue listeners on web

Open rohansohonee opened this issue 1 year ago • 2 comments

Bug report

Describe the bug Consider two active onValue listeners queryA and queryB. Now a new onValue listener queryC is added.

With the following setup if an update operation of the following is performed:

updates = {"name": "h", "desc": "test"} // full json data of h
db.ref.child("myPath").child("database_key_h").update(updates);

queryC is fired which is correct. queryB is also fired which is correct.

However queryA is being fired and the data is:

{"desc": "test"} // missing full json => {"name": "h", "desc": "test"}
{data of a}
{data of b}
{data of c}
{data of d}
{data of e}
queryA = db.ref.child("myPath").orderByChild("name").limitToFirst(5);
queryA.onValue() =  a,b,c,d,e data

queryB = db.ref.child("myPath").orderByChild("name").startAt("e", key: "database_key_e").limitToFirst(6);
queryB.onValue() = e,f,g,h,i,j data



queryC = db.ref.child("myPath").child("database_key_h");
queryC.onValue() = h data

DATA STRUCTURE IN FIREBASE REALTIME DATABASE

myPath
   database_key_a: {data of a}
   database_key_b: {data of b}
   database_key_c: {data of c}
   ...
   ...
   database_key_j: {data of j}

Expected behavior

The onValue listener should be fired based on query.


Additional context

Issue is not there on Android and iOS.


Flutter doctor

Run flutter doctor and paste the output below:

Click To Expand
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.0.2, on macOS 12.5 21G72 darwin-x64, locale en-US)
[✓] Android toolchain - develop for Android devices (Android SDK version 32.1.0-rc1)
[✓] Xcode - develop for iOS and macOS (Xcode 13.4.1)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2021.2)
[✓] VS Code (version 1.69.2)
[✓] Connected device (3 available)
[✓] HTTP Host Availability

• No issues found!


Flutter dependencies

Run flutter pub deps -- --style=compact and paste the output below:

Click To Expand
Dart SDK 2.17.3
Flutter SDK 3.0.2
agendaboa 3.5.0-dev-v5+156

dependencies:
- appsflyer_sdk 6.5.2+2 [flutter]
- async 2.8.2 [collection meta]
- auto_size_text 3.0.0 [flutter]
- bot_toast 4.0.2 [flutter]
- cached_network_image 3.2.1 [flutter flutter_cache_manager octo_image cached_network_image_platform_interface cached_network_image_web]
- charts_flutter 0.12.0 [charts_common collection flutter intl logging meta]
- cloud_firestore 3.2.1 [cloud_firestore_platform_interface cloud_firestore_web collection firebase_core firebase_core_platform_interface flutter meta]
- cloud_functions 3.3.1 [cloud_functions_platform_interface cloud_functions_web firebase_core firebase_core_platform_interface flutter]
- collection 1.16.0
- connectivity_plus 2.3.5 [flutter connectivity_plus_platform_interface connectivity_plus_linux connectivity_plus_macos connectivity_plus_web connectivity_plus_windows]
- credit_card_validator 2.0.1 [credit_card_type_detector]
- crypto 3.0.2 [typed_data]
- cupertino_icons 1.0.5
- device_info_plus 4.0.0 [flutter device_info_plus_platform_interface device_info_plus_macos device_info_plus_linux device_info_plus_web device_info_plus_windows]
- diacritic 0.1.3
- encrypt 5.0.1 [args asn1lib clock collection crypto pointycastle]
- fingerprintjs 2.0.0 [js]
- firebase_analytics 9.1.12 [firebase_analytics_platform_interface firebase_analytics_web firebase_core firebase_core_platform_interface flutter]
- firebase_auth 3.4.1 [firebase_auth_platform_interface firebase_auth_web firebase_core firebase_core_platform_interface flutter meta]
- firebase_core 1.19.1 [firebase_core_platform_interface firebase_core_web flutter meta]
- firebase_crashlytics 2.8.4 [firebase_core firebase_core_platform_interface firebase_crashlytics_platform_interface flutter stack_trace]
- firebase_database 9.0.18 [firebase_core firebase_core_platform_interface firebase_database_platform_interface firebase_database_web flutter]
- firebase_dynamic_links 4.3.1 [firebase_core firebase_core_platform_interface firebase_dynamic_links_platform_interface flutter meta plugin_platform_interface]
- firebase_in_app_messaging 0.6.0+18 [firebase_core firebase_core_platform_interface firebase_in_app_messaging_platform_interface flutter meta]
- firebase_messaging 11.4.4 [firebase_core firebase_core_platform_interface firebase_messaging_platform_interface firebase_messaging_web flutter meta]
- firebase_remote_config 2.0.11 [firebase_core firebase_core_platform_interface firebase_remote_config_platform_interface firebase_remote_config_web flutter]
- firebase_storage 10.3.1 [firebase_core firebase_core_platform_interface firebase_storage_platform_interface firebase_storage_web flutter]
- flutter 0.0.0 [characters collection material_color_utilities meta vector_math sky_engine]
- flutter_cache_manager 3.3.0 [clock collection file flutter http path path_provider pedantic rxdart sqflite uuid]
- flutter_contact 0.9.1+7 [collection dartxx equatable flexidate intl logging logging_config quiver uuid flutter]
- flutter_keyboard_visibility 5.3.0 [meta flutter_keyboard_visibility_platform_interface flutter_keyboard_visibility_web flutter]
- flutter_local_notifications 9.6.1 [clock flutter flutter_local_notifications_linux flutter_local_notifications_platform_interface timezone]
- flutter_localizations 0.0.0 [flutter intl characters clock collection material_color_utilities meta path vector_math]
- flutter_multi_formatter 2.5.7 [flutter collection base58check bech32]
- flutter_signature_pad 3.0.1 [flutter]
- flutter_sticky_header 0.6.3 [flutter value_layout_builder]
- flutter_svg 1.0.3 [flutter meta path_drawing vector_math xml]
- flutter_switch 0.3.2 [flutter]
- flutter_udid 2.0.0 [flutter crypto]
- hive 2.2.2 [meta crypto]
- hive_flutter 1.1.0 [flutter hive path_provider path]
- http 0.13.4 [async http_parser meta path]
- image 3.1.3 [archive meta xml]
- image_cropper 2.0.3 [flutter image_cropper_platform_interface image_cropper_for_web]
- image_picker 0.8.4+11 [flutter flutter_plugin_android_lifecycle image_picker_for_web image_picker_platform_interface]
- in_app_purchase 3.0.6 [flutter in_app_purchase_android in_app_purchase_platform_interface in_app_purchase_storekit]
- intercom_flutter 7.3.0 [flutter flutter_web_plugins intercom_flutter_platform_interface intercom_flutter_web]
- intl 0.17.0 [clock path]
- json_annotation 4.5.0 [meta]
- numberpicker 2.1.1 [flutter infinite_listview]
- package_info_plus 1.4.2 [flutter package_info_plus_platform_interface package_info_plus_linux package_info_plus_macos package_info_plus_windows package_info_plus_web]
- pdf 3.7.1 [archive barcode crypto image meta path_parsing vector_math xml]
- permission_handler 10.0.0 [flutter meta permission_handler_android permission_handler_apple permission_handler_windows permission_handler_platform_interface]
- printing 5.7.2 [ffi flutter flutter_web_plugins http image js meta pdf plugin_platform_interface]
- provider 6.0.3 [collection flutter nested]
- scroll_to_index 3.0.1 [flutter]
- search_cep 4.0.0+1 [flutter http xml2json dartz]
- share_plus 4.0.9 [meta mime flutter share_plus_platform_interface share_plus_linux share_plus_macos share_plus_windows share_plus_web]
- shared_preferences 2.0.15 [flutter shared_preferences_android shared_preferences_ios shared_preferences_linux shared_preferences_macos shared_preferences_platform_interface shared_preferences_web shared_preferences_windows]
- sliver_tools 0.2.7 [flutter]
- styled_text 5.1.0 [flutter xmlstream]
- url_launcher 6.1.4 [flutter url_launcher_android url_launcher_ios url_launcher_linux url_launcher_macos url_launcher_platform_interface url_launcher_web url_launcher_windows]
- url_strategy 0.2.0 [flutter_web_plugins]
- visibility_detector 0.3.3 [flutter]
- xml 5.3.1 [collection meta petitparser]
- youtube_player_iframe 2.3.0 [flutter flutter_inappwebview url_launcher]

dev dependencies:
- build_runner 2.1.11 [args async analyzer build build_config build_daemon build_resolvers build_runner_core code_builder collection crypto dart_style frontend_server_client glob graphs http_multi_server io js logging meta mime package_config path pool pub_semver pubspec_parse shelf shelf_web_socket stack_trace stream_transform timing watcher web_socket_channel yaml]
- flutter_launcher_icons 0.9.3 [args image path yaml]
- flutter_lints 1.0.4 [lints]
- flutter_native_splash 2.1.2+1 [args image js meta path xml yaml universal_io flutter flutter_web_plugins]
- flutter_test 0.0.0 [flutter test_api path fake_async clock stack_trace vector_math async boolean_selector characters charcode collection matcher material_color_utilities meta source_span stream_channel string_scanner term_glyph]
- intl_generator 0.2.1 [collection analyzer args dart_style intl path petitparser]
- json_serializable 6.2.0 [analyzer async build build_config collection json_annotation meta path pub_semver pubspec_parse source_gen source_helper]
- mockito 5.2.0 [analyzer build code_builder collection dart_style matcher meta path source_gen test_api]

dependency overrides:
- cloud_firestore_platform_interface 5.5.10 [collection firebase_core flutter meta plugin_platform_interface]
- cloud_firestore_web 2.6.19 [cloud_firestore_platform_interface collection firebase_core firebase_core_web flutter flutter_web_plugins js]
- cloud_functions_platform_interface 5.1.10 [firebase_core flutter meta plugin_platform_interface]
- cloud_functions_web 4.2.18 [cloud_functions_platform_interface firebase_core firebase_core_web flutter flutter_web_plugins js]
- firebase_analytics_platform_interface 3.1.10 [firebase_core flutter meta plugin_platform_interface]
- firebase_analytics_web 0.4.0+17 [firebase_analytics_platform_interface firebase_core firebase_core_web flutter flutter_web_plugins js]
- firebase_auth_platform_interface 6.3.1 [firebase_core flutter meta plugin_platform_interface]
- firebase_auth_web 3.3.19 [firebase_auth_platform_interface firebase_core firebase_core_web flutter flutter_web_plugins http_parser intl js meta]
- firebase_core_platform_interface 4.4.3 [collection flutter flutter_test meta plugin_platform_interface]
- firebase_core_web 1.6.6 [firebase_core_platform_interface flutter flutter_web_plugins js meta]
- firebase_database_platform_interface 0.2.1+10 [collection firebase_core flutter meta plugin_platform_interface]
- firebase_database_web 0.2.0+17 [firebase_core firebase_core_web firebase_database_platform_interface flutter flutter_web_plugins js]
- firebase_messaging_platform_interface 3.5.4 [firebase_core flutter meta plugin_platform_interface]
- firebase_messaging_web 2.4.4 [firebase_core firebase_core_web firebase_messaging_platform_interface flutter flutter_web_plugins js meta]
- firebase_remote_config_platform_interface 1.1.10 [firebase_core flutter meta plugin_platform_interface]
- firebase_remote_config_web 1.0.16 [firebase_core firebase_core_web firebase_remote_config_platform_interface flutter flutter_web_plugins js]
- firebase_storage_platform_interface 4.1.10 [collection firebase_core flutter meta plugin_platform_interface]
- firebase_storage_web 3.2.19 [async firebase_core firebase_core_web firebase_storage_platform_interface flutter flutter_web_plugins http js meta]
- flutter_contact 0.9.1+7 [collection dartxx equatable flexidate intl logging logging_config quiver uuid flutter]
- pdf 3.7.1 [archive barcode crypto image meta path_parsing vector_math xml]

transitive dependencies:
- _fe_analyzer_shared 31.0.0 [meta]
- analyzer 2.8.0 [_fe_analyzer_shared cli_util collection convert crypto glob meta package_config path pub_semver source_span watcher yaml]
- archive 3.3.1 [crypto path]
- args 2.3.1
- asn1lib 1.1.0
- barcode 2.2.1 [meta qr]
- base58check 2.0.0 [crypto collection]
- bech32 0.2.1 [convert]
- boolean_selector 2.1.0 [source_span string_scanner]
- build 2.3.0 [analyzer async convert crypto glob logging meta path]
- build_config 1.0.0 [checked_yaml json_annotation path pubspec_parse yaml]
- build_daemon 3.1.0 [built_collection built_value http_multi_server logging path pool shelf shelf_web_socket stream_transform watcher web_socket_channel]
- build_resolvers 2.0.6 [analyzer async build crypto graphs logging path package_config pool pub_semver stream_transform yaml]
- build_runner_core 7.2.3 [async build build_config build_resolvers collection convert crypto glob graphs json_annotation logging meta path package_config pool timing watcher yaml]
- built_collection 5.1.1
- built_value 8.4.0 [built_collection collection fixnum meta]
- cached_network_image_platform_interface 1.0.0 [flutter flutter_cache_manager]
- cached_network_image_web 1.0.1 [flutter flutter_cache_manager cached_network_image_platform_interface]
- characters 1.2.0
- charcode 1.3.1
- charts_common 0.12.0 [collection intl logging meta vector_math]
- checked_yaml 2.0.1 [json_annotation source_span yaml]
- cli_util 0.3.5 [meta path]
- clock 1.1.0
- code_builder 4.2.0 [built_collection built_value collection matcher meta]
- connectivity_plus_linux 1.3.1 [flutter connectivity_plus_platform_interface meta nm]
- connectivity_plus_macos 1.2.4 [connectivity_plus_platform_interface flutter]
- connectivity_plus_platform_interface 1.2.1 [flutter meta plugin_platform_interface]
- connectivity_plus_web 1.2.3 [connectivity_plus_platform_interface flutter_web_plugins flutter]
- connectivity_plus_windows 1.2.2 [connectivity_plus_platform_interface flutter]
- convert 3.0.2 [typed_data]
- credit_card_type_detector 2.0.0
- cross_file 0.3.3+1 [js meta]
- dart_style 2.2.1 [analyzer args path pub_semver source_span]
- dartx 0.7.1 [characters collection crypto meta path time]
- dartxx 0.5.5 [equatable inflection3 intl recase]
- dartz 0.10.1
- dbus 0.7.3 [args ffi meta xml]
- device_info_plus_linux 2.1.1 [device_info_plus_platform_interface file flutter meta]
- device_info_plus_macos 2.2.3 [device_info_plus_platform_interface flutter]
- device_info_plus_platform_interface 2.3.0+1 [flutter meta plugin_platform_interface]
- device_info_plus_web 2.1.0 [device_info_plus_platform_interface flutter_web_plugins flutter]
- device_info_plus_windows 2.1.1 [device_info_plus_platform_interface ffi flutter win32]
- equatable 2.0.3 [collection meta]
- fake_async 1.3.0 [clock collection]
- ffi 1.2.1
- file 6.1.2 [meta path]
- firebase_crashlytics_platform_interface 3.2.12 [collection firebase_core flutter meta plugin_platform_interface]
- firebase_dynamic_links_platform_interface 0.2.3+8 [firebase_core flutter meta plugin_platform_interface]
- firebase_in_app_messaging_platform_interface 0.2.1+12 [firebase_core flutter meta plugin_platform_interface]
- fixnum 1.0.1
- flexidate 0.8.0+3 [collection dartx dartxx equatable inflection3 intl logging timezone]
- flutter_blurhash 0.7.0 [flutter]
- flutter_inappwebview 5.4.3+7 [flutter]
- flutter_keyboard_visibility_platform_interface 2.0.0 [flutter meta plugin_platform_interface]
- flutter_keyboard_visibility_web 2.0.0 [flutter_keyboard_visibility_platform_interface flutter_web_plugins flutter]
- flutter_local_notifications_linux 0.5.1 [flutter flutter_local_notifications_platform_interface dbus path xdg_directories]
- flutter_local_notifications_platform_interface 5.0.0 [flutter plugin_platform_interface]
- flutter_plugin_android_lifecycle 2.0.7 [flutter]
- flutter_web_plugins 0.0.0 [flutter js characters collection material_color_utilities meta vector_math]
- frontend_server_client 2.1.3 [async path]
- glob 2.1.0 [async collection file path string_scanner]
- graphs 2.1.0 [collection]
- http_multi_server 3.2.1 [async]
- http_parser 4.0.1 [collection source_span string_scanner typed_data]
- image_cropper_for_web 0.0.4 [flutter flutter_web_plugins image_cropper_platform_interface js]
- image_cropper_platform_interface 2.0.0 [flutter plugin_platform_interface http]
- image_picker_for_web 2.1.8 [flutter flutter_web_plugins image_picker_platform_interface]
- image_picker_platform_interface 2.6.0 [cross_file flutter http plugin_platform_interface]
- in_app_purchase_android 0.2.3 [collection flutter in_app_purchase_platform_interface json_annotation]
- in_app_purchase_platform_interface 1.3.1 [flutter plugin_platform_interface]
- in_app_purchase_storekit 0.3.1 [collection flutter in_app_purchase_platform_interface json_annotation]
- infinite_listview 1.1.0 [flutter]
- inflection3 0.5.3+2
- intercom_flutter_platform_interface 1.2.0 [flutter plugin_platform_interface]
- intercom_flutter_web 0.2.0 [flutter flutter_web_plugins intercom_flutter_platform_interface uuid]
- io 1.0.3 [meta path string_scanner]
- js 0.6.4
- lints 1.0.1
- logging 1.0.2
- logging_config 0.6.7+7 [js logging]
- matcher 0.12.11 [stack_trace]
- material_color_utilities 0.1.4
- meta 1.7.0
- mime 1.0.2
- nested 1.0.0 [flutter]
- nm 0.5.0 [dbus]
- octo_image 1.0.2 [flutter flutter_blurhash]
- package_config 2.1.0 [path]
- package_info_plus_linux 1.0.5 [package_info_plus_platform_interface flutter path]
- package_info_plus_macos 1.3.0 [flutter]
- package_info_plus_platform_interface 1.0.2 [flutter meta plugin_platform_interface]
- package_info_plus_web 1.0.5 [flutter flutter_web_plugins http meta package_info_plus_platform_interface]
- package_info_plus_windows 1.0.5 [package_info_plus_platform_interface ffi flutter win32]
- path 1.8.1
- path_drawing 1.0.0 [vector_math meta path_parsing flutter]
- path_parsing 1.0.0 [vector_math meta]
- path_provider 2.0.11 [flutter path_provider_android path_provider_ios path_provider_linux path_provider_macos path_provider_platform_interface path_provider_windows]
- path_provider_android 2.0.17 [flutter path_provider_platform_interface]
- path_provider_ios 2.0.11 [flutter path_provider_platform_interface]
- path_provider_linux 2.1.7 [ffi flutter path path_provider_platform_interface xdg_directories]
- path_provider_macos 2.0.6 [flutter path_provider_platform_interface]
- path_provider_platform_interface 2.0.4 [flutter platform plugin_platform_interface]
- path_provider_windows 2.0.7 [ffi flutter path path_provider_platform_interface win32]
- pedantic 1.11.1
- permission_handler_android 10.0.0 [flutter permission_handler_platform_interface]
- permission_handler_apple 9.0.4 [flutter permission_handler_platform_interface]
- permission_handler_platform_interface 3.7.0 [flutter meta plugin_platform_interface]
- permission_handler_windows 0.1.0 [flutter permission_handler_platform_interface]
- petitparser 4.4.0 [meta]
- platform 3.1.0
- plugin_platform_interface 2.1.2 [meta]
- pointycastle 3.6.1 [collection convert js]
- pool 1.5.1 [async stack_trace]
- process 4.2.4 [file path platform]
- pub_semver 2.1.1 [collection meta]
- pubspec_parse 1.2.0 [checked_yaml collection json_annotation pub_semver yaml]
- qr 3.0.1 [meta]
- quiver 3.1.0 [matcher]
- recase 4.0.0
- rxdart 0.27.5
- share_plus_linux 3.0.0 [share_plus_platform_interface file flutter meta url_launcher]
- share_plus_macos 3.0.1 [share_plus_platform_interface flutter]
- share_plus_platform_interface 3.0.3 [flutter meta mime plugin_platform_interface]
- share_plus_web 3.0.1 [share_plus_platform_interface url_launcher flutter flutter_web_plugins meta]
- share_plus_windows 3.0.1 [share_plus_platform_interface flutter meta url_launcher]
- shared_preferences_android 2.0.12 [flutter shared_preferences_platform_interface]
- shared_preferences_ios 2.1.1 [flutter shared_preferences_platform_interface]
- shared_preferences_linux 2.1.1 [file flutter path path_provider_linux path_provider_platform_interface shared_preferences_platform_interface]
- shared_preferences_macos 2.0.4 [flutter shared_preferences_platform_interface]
- shared_preferences_platform_interface 2.0.0 [flutter]
- shared_preferences_web 2.0.4 [flutter flutter_web_plugins shared_preferences_platform_interface]
- shared_preferences_windows 2.1.1 [file flutter path path_provider_platform_interface path_provider_windows shared_preferences_platform_interface]
- shelf 1.3.2 [async collection http_parser path stack_trace stream_channel]
- shelf_web_socket 1.0.2 [shelf stream_channel web_socket_channel]
- sky_engine 0.0.99
- source_gen 1.2.2 [analyzer async build dart_style glob meta path source_span yaml]
- source_helper 1.3.2 [analyzer collection source_gen]
- source_span 1.8.2 [collection path term_glyph]
- sqflite 2.0.3 [flutter sqflite_common path]
- sqflite_common 2.2.1+1 [synchronized path meta]
- stack_trace 1.10.0 [path]
- stream_channel 2.1.0 [async]
- stream_transform 2.0.0
- string_scanner 1.1.0 [charcode source_span]
- synchronized 3.0.0+2
- term_glyph 1.2.0
- test_api 0.4.9 [async boolean_selector collection meta source_span stack_trace stream_channel string_scanner term_glyph matcher]
- time 2.1.1 [clock]
- timezone 0.8.0 [path]
- timing 1.0.0 [json_annotation]
- typed_data 1.3.1 [collection]
- universal_io 2.0.4 [collection crypto meta typed_data]
- url_launcher_android 6.0.17 [flutter url_launcher_platform_interface]
- url_launcher_ios 6.0.17 [flutter url_launcher_platform_interface]
- url_launcher_linux 3.0.1 [flutter url_launcher_platform_interface]
- url_launcher_macos 3.0.1 [flutter url_launcher_platform_interface]
- url_launcher_platform_interface 2.1.0 [flutter plugin_platform_interface]
- url_launcher_web 2.0.12 [flutter flutter_web_plugins url_launcher_platform_interface]
- url_launcher_windows 3.0.1 [flutter url_launcher_platform_interface]
- uuid 3.0.6 [crypto]
- value_layout_builder 0.3.1 [flutter]
- vector_math 2.1.2
- watcher 1.0.1 [async path]
- web_socket_channel 2.2.0 [async crypto stream_channel]
- win32 2.6.1 [ffi]
- xdg_directories 0.2.0+1 [meta path process]
- xml2json 5.3.2 [xml]
- xmlstream 1.0.0
- yaml 3.1.1 [collection source_span string_scanner]


rohansohonee avatar Aug 04 '22 19:08 rohansohonee

Also including here an existing issue from the firebase js sdk github repo https://github.com/firebase/firebase-js-sdk/issues/861

It may describe this behavior which was faced:

{"desc": "test"} // missing full json => {"name": "h", "desc": "test"}

rohansohonee avatar Aug 04 '22 19:08 rohansohonee

Thanks for the detailed report and an existing issue at native side. Looking at the original issue, it seems to be an issue at js side and probably not at client, considering the fact that you mentioned, it works on mobile platform. I suggest you to share you findings in that issue, or open a new issue there (since the linked issue is open since 2018 and there doesn't seem to be any activity in it).

darshankawar avatar Aug 09 '22 07:08 darshankawar

Hey @rohansohonee. We need more information to resolve this issue but there hasn't been an update in 7 weekdays. I'm marking the issue as stale and if there are no new updates in the next 7 days I will close it automatically.

If you have more information that will help us get to the bottom of this, just add a comment!

google-oss-bot avatar Aug 18 '22 01:08 google-oss-bot

Since there haven't been any recent updates here, I am going to close this issue.

@rohansohonee if you're still experiencing this problem and want to continue the discussion just leave a comment here and we are happy to re-open this.

google-oss-bot avatar Aug 29 '22 01:08 google-oss-bot