-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
🔥startAfter not working correctly when passing a document, when there are multiple documents matching the filtered fields #2854
Comments
This comment has been minimized.
This comment has been minimized.
@shripadashtekar Please create a new issue for... your new issue. Adding more information here, does not help either this issue, or the new one you found. |
Hey @puf - I don't see some of the information in the template, but you link directly to a source file that makes me 99.9% sure you mean react-native-firebase v6, and indeed though it was a commit-hash in the link that appears to be the latest commit and the line appears the same in master as of today. Is that correct? Just want to make sure we're talking about exactly the same code. Normally the template is vital but I think this report may be complete regardless... |
@puf sure. I'll create a new issue for the same. |
Hey Mike, The |
Hey @puf - thanks for the detailed report. I'll investigate this and see where the issue is. |
Sure thing Elliot. Let me know if there's anything I can help with, as it
seems quite fundamental. Either here or on mail (puf@g.c) is fine.
I also filed an internal bug to get the docs clarified, as it's now easy to
misunderstand them in the case where you're passing a list of field values.
…On Mon, Nov 11, 2019 at 3:23 AM Elliot Hesp ***@***.***> wrote:
Hey @puf <https://github.com/puf> - thanks for the detailed report. I'll
investigate this and see where the issue is.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#2854?email_source=notifications&email_token=AAG7BX42K24XWM2YXY2XJP3QTE6CNA5CNFSM4JLMW2T2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEDWQJ5I#issuecomment-552404213>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAG7BXYUUXCUPII3XHLSOV3QTE6CNANCNFSM4JLMW2TQ>
.
|
Hey Elliott, |
Hey @puf We've had a good look into what's going on here. Currently we have some limitations on how we can do this for React Native: Parsing a
|
@Ehesp Hi Elliot. Firestore SDK engineer here. I am curious about the "Using name field value" issue you're running into where you get prompted to construct an index. That shouldn't happen as far as I know and I'd love more details about what you're doing. For a bit of context, any time you construct a query and don't include 'name' in the orderBys, Firestore will implicitly assume an additional This means:
In all of these cases, the before and after versions of the query use the same index, and so no additional index needs to be constructed. Perhaps when you are adding the name orderBy you aren't matching the correct direction, leading to the prompt to create an index and resulting difficulties. |
Ah, thank you for this - looks like this is what we've missed then - I've pushed up #2866 and added tests based on the example @puf provided and all seems to be working now 🎉 its no longer failing and prompting for an index. Thanks for your helping debugging this everyone, providing CI passes I'll get a patch release out later today |
This comment has been minimized.
This comment has been minimized.
* fix(firestore): correctly apply internal `__name__` query modifier (fixes #2854) * chore(tests): cleanup unnecessary code
HI Team, |
@shripadashtekar I think you'd have to backport it - it should go somewhere around here https://github.com/invertase/react-native-firebase/blob/v5.x.x/src/modules/firestore/Query.js#L462 but the code there has diverged quite a bit from v5 to v6 so you'll have to take care that the query you emit is actually what you intend Forward-porting to react-native 0.60+ / react-native-firebase v6 may be a similar amount of effort, it's hard to say - but it is possible to say that the forward-port effort may only be deferred, not eliminated, so that effort may be the better time investment over time if it can be justified in your project |
Thanks, but if you can help me with the actual changes(if not many) for 5.5.6, I'll be grateful, as I am not aware of the code and will take time for me to figure out the change. |
Sorry, I can't commit to any time on it, and I'm not familiar with that area either |
No Problem @mikehardy . @Salakar Could you please help me with the same? My entire application is dependent on pagination, so it's a blocker for me. |
Hey all, the fix is now live in v6.0.4. Thanks |
Thanks for the quick turnaround Mike! 🙏 |
Sorry for comment. I am looking for solution... But where().where().startAfter().limit().get(). works correctly, "@react-native-firebase/firestore": "10.4.0", |
Interesting situation with my last comment: |
Don't waste any time with old versions, glad you updated that. |
@mikehardy D/TEST: size = 10 |
🤔 so it appears it is working for the native sdk but obviously we're not doing something correctly the README in the tests directory should get you set up with an inspection rig for this module within just a few minutes, then if you add '.only' to any of the tests in packages/firestore/e2e and run it on android you can execute just that one test (an existing one, or a new one, suggest making a new one in the issues area). If you can get it reproducing in the e2e tests then you've got a really fast path towards iterating / instrumenting the module code and seeing exactly what/where things are going wrong, and probably can get a fix up. You know your use case better than anyone and I sincerely believe it won't take long to do - that's where I'd suggest going next A couple deep-links https://github.com/invertase/react-native-firebase/blob/master/tests/README.md#running-specific-tests |
@mikehardy In 10.4.1 this problem is not reproduced. Thanks for answers. |
…ertase#2866) * fix(firestore): correctly apply internal `__name__` query modifier (fixes invertase#2854) * chore(tests): cleanup unnecessary code
Issue
If you have a collection where multiple documents have the same value for a field you order on, the startAfter method always returns the first document with the value. It is supposed to use the ID of the document as a disambiguation key, but that key is being dropped from the query in _handleQueryCursor.
For an example of how to reproduce this (and how it should work), see my answer to this question on Stack Overflow and this jsbin. The code from there:
Output
This is the output from the regular JavaScript SDK, and is correct: the second page starts with the document after the last document on the first page.
If you run this same code (feel free to use my database, by copying the config from the jsbin) in React Native, it starts the second page with document
mr7MdAygvuheF6AUtWma
, thus skipping8Ek8iWCDQPPJ5s2n8PiQ
. I didn't try, but expect thatstartAt
would instead start the second page withwbXwyLJheRfYXXWlY46j
again.Project Files
iOS
Click To Expand
ios/Podfile
:# N/A
AppDelegate.m
:// N/A
Android
Click To Expand
Have you converted to AndroidX?
android/gradle.settings
jetifier=true
for Android compatibility?jetifier
for react-native compatibility?android/build.gradle
:// N/A
android/app/build.gradle
:// N/A
android/settings.gradle
:// N/A
MainApplication.java
:// N/A
AndroidManifest.xml
:<!-- N/A -->
Environment
Click To Expand
react-native info
output:react-native-firebase
version you're using that has this issue:e.g. 5.4.3
Firebase
module(s) you're using that has the issue:e.g. Instance ID
TypeScript
?Y/N
&VERSION
Think
react-native-firebase
is great? Please consider supporting all of the project maintainers and contributors by donating via our Open Collective where all contributors can submit expenses. [Learn More]React Native Firebase
andInvertase
on Twitter for updates on the library.The text was updated successfully, but these errors were encountered: