-
Notifications
You must be signed in to change notification settings - Fork 49
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
Really weird behaviour, perhaps caching? #34
Comments
Ok, so I think I'm getting close. Running a query like this (in the browser console) But running with a |
I tried setting .config({ then, if I log the database constant to console, the EDIT. Nevermind, calling |
I'm starting to suspect that something weird is going on in the build process. Chrome connects to the database, but Firefox doesn't until I manually run in the browser's console Then firefox works as expected, without the issue. |
Ok. So in the end, the solution was to make sure that webpack runs nano-sql through babel. I'm still not sure what the problem was, but it is most definitely related to |
Nope, that was not a solution. Just got too tired and put the db into TEMP mode by accident |
Set the mode to "LS" and let me know what happens. It's possible the other libraries are messing about with the contents of IndexedDB. |
Sounds good. I will when I get the chance tomorrow. |
PS. One error that I kept thinking was coming from improper If I externalize Is it possible to connect to the DB too early? |
Setting the value to |
We might need to open two issues for this. 😃 Re: No plugins error The Calling connect with Re: The IndexedDB Problem As far as the issue you were having originally, I suspect localForage and nanoSQL are conflicting on the indexedDB code somehow. |
Re: No plugins error Re: The IndexedDB Problem And as far as I can tell, this is a nano-sql issue. If I set the mode to IDB (or any other except LS) this is what happens. BUT, the select query within the onChange method shows the stale value. I also check the db directly in dev tools and I can see the right value there. (though I can't check the value if I pause the debugger within onChange) Now if I change the mode to LS and do nothing else, all the values behave as expected. PS. Thank you for your help. :) |
I can also run a function from console which will log the value. Something else to mention. The pattern is like this (on chrome) PS. all of this happens with cache turned on or off. |
Re: No plugins error Re: The IndexedDB Problem |
Nope. Didn't help. https://drive.google.com/open?id=1q71jRBdZZIesLVmdj1Iw6rv7dbt22sUe The console logs a bunch of things, so that might be a bit confusing, sorry. To reproduce do: (in Chrome, Firefox behaves similarly, but not identical)
Files you want to take a look at:
I hope this helps. PS. One observation that I failed to make is that the "Community" table is perhaps the only table that this happens to. As you will notice, in the UI, the "Balance" updates every time, which means that "AgentWalletTable" does not experience this issue. |
Interesting, somehow the cache isn't getting invalidated correctly. On top of that the Just pushed Thanks for helping out with the example! |
Sir, you are most welcome. It's the least I can do with how helpful you've been. Please keep in mind that I might be doing something very wrong somewhere. My webpack build process might be causing this, or maybe babel setup. Or maybe even something else. Thank you very much! |
Marking this as resolved, feel free to re open it if this issue comes up again. |
Sounds good. Thanks. |
Hi Scott, This issue seems to be back when using nano-sql-react I deleted all nano-sql related packages, and installed from scratch all the latest versions. I have to leave on Saturday, so I can't afford to dive deep into the issue. |
I can confirm that setting cache to false solves the problem |
I'm using nanosql in my project to create a library that I then include into a different project.
When I do the tests on my library everything works fine. But when I include it into the other project there's this really weird issue. The setup is as follows:
onChange
onChange
I use aselect
query to get the new valueWhen I update the row, I can see a
console.log
showing that COLUMN has been changed to 1The event passed into
onChange
is showing the same, withquery.state
beingcomplete
But the
select
within theonChange
is showing the old value! It still shows 0!This is where it gets really weird.
If the mode is set to TEMP everything works.
If the mode is set to PERM, but I'm testing just my library everything works.
The only time this doesn't work, is when I use the library within the other project, and the mode is PERM.
This is very hairy.
PS. The other project uses
redux-persist
withlocalforage
The text was updated successfully, but these errors were encountered: