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
[3.0] insertAsync on client won't persist local document #13036
Comments
Thank you for your detailed report.
Yes, I would say we could persue this behavior and making it persistant on use server promise, but it has not been an easy task. I would like to test though some of the debugging points you mentioned. However, the best I can say for now is the usage of |
Please, refer to this comment to understand the nature of the new async approach using promises in comparison on how was handled on previous Meteor versions. In this specific issue you must use |
Description / reproduction
Please check this failing test: https://github.com/bhunjadi/meteor/blob/795e61aff0c191257937c07eccad7438b2394de4/packages/mongo/allow_tests.js#L1164
Run the test with:
After insertAsync, client doesn't have the document in local collection anymore.
I first observed this when updating meteor-collection-hooks for Meteor 3.0. Here is the failing test.
Notes:
Debugging:
I noticed that local document exists briefly and it gets deleted.
It seems to me this is because additional event is triggered which removes the document.
What happens is that collection.update method is called with
replace
msg.If you look in collection.js the
replace
value will be undefined, which will trigger the removal of the document couple of lines below.Why it is undefined? Because of this line in minimongo/local_collection.
I also observed that adding resolverType: 'stub' fixes the test.
Version
Forked
release-3.0
repoLast version where the problem did not occur
n/a (there was no insertAsync on client)
OS
WSL2 (2.0.14), Ubuntu 22.04.4 LTS
Kernel: 5.15.133.1-microsoft-standard-WSL2
Expected behavior
Document should be in local collection.
Actual behavior
Document is not persisted in local collection.
The text was updated successfully, but these errors were encountered: