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
fix(firebase_database): Firebase_Database Assertion error on push for sorted FirebaseAnimatedList #9838
Conversation
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
_snapshots.sort(comparator); | ||
onChildAdded!(_snapshots.indexOf(event.snapshot), event.snapshot); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it gives index always -1 when sorting is there
packages/firebase_database/firebase_database/lib/ui/firebase_sorted_list.dart
Show resolved
Hide resolved
can some one give a reply/acknowledgment here? |
both failed checks are irrelevant to firebase_database |
@dipakp2726 Could you merge with master locally and push to remote, please? |
merged |
https://github.com/dipakp2726/firebase_database_reproduce |
packages/firebase_database/firebase_database/lib/ui/firebase_sorted_list.dart
Show resolved
Hide resolved
test for sorted list doesn't exists |
looking at the existing tests, I am not sure if I can write a test that can produce this since there is a lot of mocking going on that I am not able to understand. can you give me a suggestion regarding the writing test that produces it? |
@dipakp2726 You can find the e2e test (that open a firebase simulator in CI) here: tests/integration_test/firebase_database/database_e2e.dart Looking at the issue in depth, its caused by this line: packages/firebase_database/firebase_database/lib/src/database_event.dart:20
Where we don't cache the result of the snapshot. I would modify this file with the content of #9899 Can you try this PR to see if you see the expected results on your end? |
what's next? @Lyokone |
@dipakp2726 the #9899 is being reviewed, once it has been approved it will be merged and we can close this PR as well |
thank you |
Description
fixed OnChildAdded so its get the correct index when new key is pushed.
Related Issues
fixes #7100,#9837
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.///
).melos run analyze
) does not report any problems on my PR.Breaking Change
Does your PR require plugin users to manually update their apps to accommodate your change?