samuelgozi/firebase-firestore-lite

Error when fetching with offset

Closed this issue ยท 9 comments

Hi, thank you for really good project.
I start using this project and encountered some problem - when i fetching data with offset > 0 then i got an error:
Uncaught (in promise) TypeError: Cannot destructure property 'name' of 'rawDoc' as it is undefined. at new Document (Document.js:18) at eval (Query.js:235) at Array.map (<anonymous>) at Query.run (Query.js:235)
In that case in response i had at index 0 not document, but this object:
0: {readTime: "2020-07-04T03:05:24.457943Z", skippedResults: 2}
Any ideas?
Thank you.

Issue-Label Bot is automatically applying the label bug to this issue, with a confidence of 0.88. Please mark this comment with ๐Ÿ‘ or ๐Ÿ‘Ž to give our bot feedback!

Links: app homepage, dashboard and code for this bot.

Thanks for opening an issue.
Can you please provide code to reproduce this error?

Thanks for opening an issue.
Can you please provide code to reproduce this error?

If i fetch data with offset 0, then everything OK. Otherwise - error.

OK:

const DB = new Database({projectId: 'cppr-47808'});
const newsRef = DB.ref('news');
const newsQuery = newsRef.query().orderBy({field: 'date', direction: 'desc'}).offset(0).limit(2);
const response = await newsQuery.run();

Error:

const DB = new Database({projectId: 'cppr-47808'});
const newsRef = DB.ref('news');
const newsQuery = newsRef.query().orderBy({field: 'date', direction: 'desc'}).offset(1).limit(2);
const response = await newsQuery.run();

DB contains only 4 documents for tests.

Ok, looking into it right now.

@DKGraf I was unable to reproduce this error.
Which version of the library are you using?

@samuelgozi version is 1.0.0-RC1
Strange, i tried right now and had same result - error.

Here is HAR
localhost.zip

Thanks the HAR file helped a lot.
I see the issue. I'm a little it bussy right now but I'll fix it ASAP and update.

I released a fix in version 1.0.0-RC1.1. Make sure you update.
Please let me know if everything works as expected or otherwise.
And feel free to reopen the issue, or ask anything.

I released a fix in version 1.0.0-RC1.1. Make sure you update.

Thank you!
It works as expected now.