samuk190 / localbase

A Firebase-Style Database ... Offline!
636 stars 84 forks source link

Certain Query Properties Remain #87

Closed sma27 closed 2 months ago

sma27 commented 2 months ago

I've noticed if I run multiple queries on the same DB connection certain properties sometimes remain. For instance if I run a query with a limit and then another without a limit, the second will run with the limit from the first query.

Am I supposed to create the database connection before each query? Or is this a bug?

// Running this before each query fixes the problem const db = new Localbase("myDb");

A couple more notes. I am calling the get() methods using async/await. Looking through the source code I see a function that gets called throughout on success or on then called reset. I'm guessing this method isn't run if not using a promise?

Thanks

sma27 commented 2 months ago

I can't delete this issue, so I'll just confess this was my issue. I had a problem somewhere with async / await. One function was using a promise and the others were all using async / await. It appears mixing those caused the reset to not run properly coming in and out of functions. Thanks again for this great library!

samuk190 commented 2 months ago

I can't delete this issue, so I'll just confess this was my issue. I had a problem somewhere with async / await. One function was using a promise and the others were all using async / await. It appears mixing those caused the reset to not run properly coming in and out of functions. Thanks again for this great library!

Thanks for sharing knowleadge, I'm just curious, you were using the latest release?

sma27 commented 2 months ago

Yes, 0.7.7 release downloaded from npm.