-
-
Notifications
You must be signed in to change notification settings - Fork 50
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
Stack overflow when collection is large and becomes unobserved #58
Comments
A further note to this. I tried to get around it by setting |
Hi, is there a way I could reproduce this? Can you maybe share an simple online example in StackBlitz which triggers this problem? |
I think it'll happen when too many docs in a collection. Will try to do small example online. |
Cool! |
@IjzerenHein: Here you go: https://stackblitz.com/edit/react-tzdzlo?file=Hello.js Check the checkbox. Wait for it to update. Then uncheck it and you should get a stock overflow. I guess in Stackblitz you don't get proper stacktraces for some reason. But you should be able to replicate locally. I've made one Collection in my app readable without auth to test this. I'd like to remove that permission soon so please post here when you have the info you need. |
FYI, that collection has just over 2000 docs in it. I know that's excessive... but I think this is still a bug. |
Hey, thanks for the online demo/test, that is very helpful. I've been looking into it but haven't found a solution yet. I noticed that there were some similar issues that people where having with certain mobx versions. I tried downgrading to mobx 4.7 and upgrading to 5.7, but that didn't solve the problem. |
Thanks for the update and your time. Since you now have a unit test to reproduce I'll disable public access to the collection. |
Any update on this? We are using Firestorter too and experience this problem when we navigate away from a page that is rendering lots of documents inside a collection. |
@samosaboy I was able to work around this issue by extending class DisabledDocument extends Document {
addObserverRef(): number {
return 0;
}
releaseObserverRef(): number {
return 0;
}
}
// tell firestorter to use our custom Document class when processing docs
const col = new Collection<DisabledDocument>('collection_path', {
createDocument: (source, options) => new DisabledDocument(source, {...options, mode: Mode.Off})
}); |
Any further update? |
If I have a lot of documents in a
Collection
I'm getting the following stack overflow when that collection becomes unobserved:Although it mentions
MetricBatchDoc
(my ownDocument
subclass) it can't be affecting it. The entire definition is:This is after a
yarn upgrade
so it's the latest versions of everything:To be certain of the 2 lines in Firestorter involved it's the
runInAction
line in this method:Called from this override of Mobx's Atom:
I'm pretty sure it's not infinite recursion because:
debug: true
on then theconsole.debug
statement in the abovereleaseObserverRef
lists a different document each timeSo it's like in the process of handling one document becoming unobserved it triggers another document to become unobserved, calling deeper, rather than them being processed linearly.
The text was updated successfully, but these errors were encountered: