Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[firestore]: Firestore snapshot does return empty data for existing doc #12755

Open
1 task done
mogol opened this issue May 7, 2024 · 2 comments
Open
1 task done

[firestore]: Firestore snapshot does return empty data for existing doc #12755

mogol opened this issue May 7, 2024 · 2 comments
Labels
platform: web Issues / PRs which are specifically for web. plugin: cloud_firestore type: bug Something isn't working

Comments

@mogol
Copy link
Contributor

mogol commented May 7, 2024

Is there an existing issue for this?

  • I have searched the existing issues.

Which plugins are affected?

Database

Which platforms are affected?

Web

Description

If the persistence is enabled for web, some snapshots return not exist even if docs do exist.

It can be reproduced when 1) firebase auth is used 2) the persistence is enabled 3) a user deletes site data

Reproducing the issue

An example project: https://github.com/mogol/firestore-web-flutter/blob/master/lib/main.dart

  • Launch the web app
  • Click +
  • The value is increased.
  • Delete site data in Chrome: Settings -> Privacy & Security -> See all site data and permissions -> Delete localhost
  • As expected an error with Permissions is shown.
  • Refresh the tab
  • It shows that the doc doesn't exit. Expected: it should display the latest value.
  • Click +
  • The value is increased and updated.

If persistence is off, it works as expected: it shows the latest value after tab refresh.

FirebaseFirestore.instance.settings = const Settings(persistenceEnabled: false);

Firebase Core version

2.30.1

Flutter Version

3.19.6

Relevant Log Output

No response

Flutter dependencies

Expand Flutter dependencies snippet
Dart SDK 3.3.4
Flutter SDK 3.19.6
firestore_bug 0.1.0

dependencies:
- cloud_firestore 4.17.2 [cloud_firestore_platform_interface cloud_firestore_web collection firebase_core firebase_core_platform_interface flutter meta]
- firebase_auth 4.19.4 [firebase_auth_platform_interface firebase_auth_web firebase_core firebase_core_platform_interface flutter meta]
- firebase_core 2.30.1 [firebase_core_platform_interface firebase_core_web flutter meta]
- flutter 0.0.0 [characters collection material_color_utilities meta vector_math sky_engine]

dev dependencies:
- flutter_lints 3.0.2 [lints]
- flutter_test 0.0.0 [flutter test_api matcher path fake_async clock stack_trace vector_math leak_tracker_flutter_testing async boolean_selector characters collection leak_tracker leak_tracker_testing material_color_utilities meta source_span stream_channel string_scanner term_glyph vm_service]

transitive dependencies:
- _flutterfire_internals 1.3.32 [collection firebase_core firebase_core_platform_interface flutter meta]
- async 2.11.0 [collection meta]
- boolean_selector 2.1.1 [source_span string_scanner]
- characters 1.3.0
- clock 1.1.1
- cloud_firestore_platform_interface 6.2.2 [_flutterfire_internals collection firebase_core flutter meta plugin_platform_interface]
- cloud_firestore_web 3.12.2 [_flutterfire_internals cloud_firestore_platform_interface collection firebase_core firebase_core_web flutter flutter_web_plugins]
- collection 1.18.0
- fake_async 1.3.1 [clock collection]
- firebase_auth_platform_interface 7.2.5 [_flutterfire_internals collection firebase_core flutter meta plugin_platform_interface]
- firebase_auth_web 5.11.4 [firebase_auth_platform_interface firebase_core firebase_core_web flutter flutter_web_plugins http_parser meta web]
- firebase_core_platform_interface 5.0.0 [collection flutter flutter_test meta plugin_platform_interface]
- firebase_core_web 2.16.0 [firebase_core_platform_interface flutter flutter_web_plugins meta web]
- flutter_web_plugins 0.0.0 [flutter characters collection material_color_utilities meta vector_math]
- http_parser 4.0.2 [collection source_span string_scanner typed_data]
- leak_tracker 10.0.0 [clock collection meta path vm_service]
- leak_tracker_flutter_testing 2.0.1 [flutter leak_tracker leak_tracker_testing matcher meta]
- leak_tracker_testing 2.0.1 [leak_tracker matcher meta]
- lints 3.0.0
- matcher 0.12.16+1 [async meta stack_trace term_glyph test_api]
- material_color_utilities 0.8.0 [collection]
- meta 1.11.0
- path 1.9.0
- plugin_platform_interface 2.1.8 [meta]
- sky_engine 0.0.99
- source_span 1.10.0 [collection path term_glyph]
- stack_trace 1.11.1 [path]
- stream_channel 2.1.2 [async]
- string_scanner 1.2.0 [source_span]
- term_glyph 1.2.1
- test_api 0.6.1 [async boolean_selector collection meta source_span stack_trace stream_channel string_scanner term_glyph]
- typed_data 1.3.2 [collection]
- vector_math 2.1.4
- vm_service 13.0.0
- web 0.5.1


Additional context and comments

Seems related to #10331

@mogol mogol added Needs Attention This issue needs maintainer attention. type: bug Something isn't working labels May 7, 2024
@TarekkMA
Copy link
Contributor

TarekkMA commented May 8, 2024

@mogol, thank you for reporting this issue and providing reproduction steps and a repo. I'll take a look.

@TarekkMA TarekkMA added plugin: cloud_firestore platform: web Issues / PRs which are specifically for web. labels May 8, 2024
@TarekkMA
Copy link
Contributor

TarekkMA commented May 8, 2024

I recreated the issue, and it doesn't seem to happen when I use only JavaScript code (see the repo here). We'll look into solving this issue soon.

cc @Lyokone

@TarekkMA TarekkMA removed the Needs Attention This issue needs maintainer attention. label May 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
platform: web Issues / PRs which are specifically for web. plugin: cloud_firestore type: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants