-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Cannot read property '_rev' of undefined error #939
Comments
It's so odd to me that if I re-fresh the page and If there's any additional clean up I need to do other than And another interesting observation, the second login could be to the same or a different DB, and either way you get the same error. |
Can you put a sleep between the destroy and re-create? |
Yeah, what I do is I
|
Can it be that the database is not created when you call destroy? Does the error also apear if you wait some seconds before logout? |
Ok, here's another piece of the puzzle. If I rollback versions of the following three packages, it works!
So what has changed since then that could be causing this? |
Well, much has changed in the last breaking version :) |
Well, I assume Also, my "create" flow doesn't return until the async creation processes are complete, so there would be no
|
FWIW, that code is mostly from the react example in the repo. I imagine if you tweaked it to try a db destroy and recreation, the same issue would happen. |
Then it shouldn't be that hard to create a test-case :) |
oh man, you guys really make bug reporters work! I''ll see if I could tweak that react example to reproduce it. |
@pubkey Ok, so I just made some minimal tweaks to the React example and was able to reproduce it: https://github.com/rmisio/rxdb/tree/master/examples/react |
Ok, I figured out the root cause. This is directly from the React example:
Which is driven by a hard-coded
The issue is that So, if you make sure to give it a fresh object, the issue doesn't happen:
Not sure it should be modifying the argument like that, particularly in a way that makes it not useable again if you re-connect to the db. I think that's why many linters flag if you modify a function argument. But, if that's unavoidable, at least the example should be modified and/or something to let users know their data structure will be modified in such a way that you won'd be able to call |
@rmisio thank you for the research. This helped a lot. |
Case
Maybe a bug...?
Issue
Info
I'm getting the following exception when re-connecting to a database:
So, I have a
login
flow which connects you to a database. The first time I run it, it works. If I refresh the page and try andlogin
again, no issue. But, if Ilogin
,logout
and thenre-login
again, the above exception is happening on this code block:As part of the
logout
flow I am callingdestroy
on the db instance and I have logs which show it completing.Any idea what the issue may be?
The text was updated successfully, but these errors were encountered: