jsonapi-serializer
jsonapi-serializer copied to clipboard
fix(deserialization): deserialization with very big ids is very slow
In the function findIncluded
in jsonapi-serializer/lib/deserializer-utils.js
var path = [
from.type,
from.id,
relationshipName,
relationshipData.type,
relationshipData.id,
]
_merge(alreadyIncluded, _set({}, path, true));
_merge(alreadyIncluded, _set({}, path, true))
will be an array of from.id
elements.
For exemple if from.id
value is '20000000'
, alreadyIncluded
will be an array of 20000000 elements.
This just bit us today - hope this can get merged soon.
Ran into this issue as well.
Edit: I confused myself. This PR as-is fixes the problem for me. Can make a separate PR if I see this one stagnate -- hope we can get this merged in soon.~~ Thank you @SeyZ / @alex00 / @jboler / @itsfadnis !
~~Seems like this PR is not enough as-is -- the changes suggested by @jboler and implemented by @itsfadnis at 4d5d9b664208c86d571ff6165940f2215ad8c32b have solved the problem for me.~~
~~Since @itsfadnis' fork has a few other changes on master, I made a minimal fork here: https://github.com/runtrizapps/jsonapi-serializer~~
~~This change can be opted into with the following in package.json
:~~
-snip-
Same problem here. I use ids like 25241661 and this ends up with a "JavaScript heap out of memory" error. After manually applying the fix of jboler the problem was solved.
@alex00 Could you check the comments in your PR, update it and rebase?