-
-
Notifications
You must be signed in to change notification settings - Fork 26
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
Disable variables serialization cache #700
Comments
WeakMap is by definition allow garbage collection and is prune to lost anytime, what exactly is the problem you are observing? |
We have crash of the browser on the devices with small amount of memory |
It should be possible to have a core client configuration to globally disable serialization cache, but doing it per query/mutation is impossible. But at the same time, the cache should be garbage collected with WeakMap, this is might be unexpected behavior from the js engine. On the other hand, the serialization is being weakly cached because the client logic requires very frequent serialization of variables and data, and disabling it might mean slower performance, but I can see the requirement of gqty being run in devices with very low memory where having the serialized version of "every" object is already too much extra memory usage |
After further investigation, I came to the conclusion that the problem is not in WeakMap, but in gqty/packages/gqty/src/Selection/SelectionManager.ts Lines 122 to 132 in cbb3e58
|
Interesting, thank you for taking the time for it, the issue here is that gqty needs to keep track of the serialized version of the variables to be able to know what unique alias corresponds to a specific query, one alternative would be to hash the variables into a short version, but that would be a lot slower 😢 |
We're trying to upload file thru
useMutation
and passFile
to mutation argument.But because of variable serialization via
WeakMap
GC cannot clear cache.How can we disable this cache for variables serialization?
The text was updated successfully, but these errors were encountered: