这是indexloc提供的服务,不要输入任何密码
Skip to content

fix(firestore, web): stop cleaning up snapshot listeners in debug #13119

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

Merged
merged 5 commits into from
Jul 30, 2024

Conversation

russellwheatley
Copy link
Member

Description

Replace this paragraph with a description of what this PR is doing. If you're modifying existing behavior, describe the existing behavior, how this PR is changing it, and what motivated the change.

Related Issues

fixes #13019

Checklist

Before you create this PR confirm that it meets all requirements listed below by checking the relevant checkboxes ([x]).
This will ensure a smooth and quick review process. Updating the pubspec.yaml and changelogs is not required.

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • My PR includes unit or integration tests for all changed/updated/fixed behaviors (See Contributor Guide).
  • All existing and new tests are passing.
  • I updated/added relevant documentation (doc comments with ///).
  • The analyzer (melos run analyze) does not report any problems on my PR.
  • I read and followed the Flutter Style Guide.
  • I signed the CLA.
  • I am willing to follow-up on review comments in a timely manner.

Breaking Change

Does your PR require plugin users to manually update their apps to accommodate your change?

  • Yes, this is a breaking change.
  • No, this is not a breaking change.

Copy link
Contributor

@alextekartik alextekartik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

firestore = FirebaseFirestore.instance;
collection = firestore
.collection('flutter-tests/web-snapshot-listeners/query-tests');
document = collection.doc('doc1');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good it you can add a test with 2 ref on the same doc (since that was the original issue):

documentRef1 = collection.doc('doc1');
documentRef2 = collection.doc('doc1');

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done 👍

@@ -101,7 +101,7 @@ class Firestore extends JsObjectWrapper<firestore_interop.FirestoreJsImpl> {
}

// purely for debug mode and tracking listeners to clean up on "hot restart"
final Map<String, int> _snapshotInSyncListeners = {};
static final Map<String, int> _snapshotInSyncListeners = {};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah! static is the solution!

@russellwheatley russellwheatley requested review from alextekartik and removed request for alextekartik July 30, 2024 11:50
@Lyokone
Copy link
Contributor

Lyokone commented Jul 30, 2024

Is there other places where this fix could be implemented?

@russellwheatley
Copy link
Member Author

@Lyokone - I think so, I'll have to double check as the issue was the map was being recreated for each query. I'll create PRs for others if needed 👍

@russellwheatley russellwheatley merged commit 82a63c8 into master Jul 30, 2024
22 of 23 checks passed
@russellwheatley russellwheatley deleted the fix-firestore-hot-reload-web branch July 30, 2024 13:05
@firebase firebase locked and limited conversation to collaborators Aug 30, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[firebase_firestore]: Stream does not load value, but future does on web
4 participants