question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Function `denormalize` throws `RangeError: Maximum call stack size exceeded` - support selecting normalized objects by id

See original GitHub issue

I still haven’t been able to figure out how or why, but sometimes the function denormalize in normalizers/denormalize.js, will go into an infinite recursion loop while loading data.

Uncaught RangeError: Maximum call stack size exceeded
    at denormalize.js:21
    at Array.reduce (<anonymous>)
    at denormalize (denormalize.js:21)
    at denormalize (denormalize.js:7)
    at denormalize.js:24
    at Array.reduce (<anonymous>)
    at denormalize (denormalize.js:21)
    at denormalize (denormalize.js:7)
    at denormalize.js:12
    at Array.map (<anonymous>)

Not sure where to start debugging it… The trace starts in getQuerySelector, so I’m trying to use that to obtain the result of a normalized request.

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:17 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
klis87commented, Apr 22, 2020

@zeraien usedKeys would be provided to new selector like getNormalizedObjectById

normally this selector would just get id and it would return proper object, but if leading to recursive error, this would be catched and warning would be shown in console.

then someone could do thing like:

const myObject = getNormalizedObjectById(state, { id: '1', usedKeys: {
  id: true,
  name: true,
  bestFriend: {
    id: true,
    name: true,
  }  
}}});

So usedKeys would be provided in easy to work with way by human, while library would convert it to the same structure as stored in reducer. Probably this would be used very sparingly, only when recursive relationship, but we would have an escape hatch so I could work on getNormalizedObjectById

0reactions
klis87commented, Apr 22, 2020

if I think about it more, this looks like graphql fragment concept, but for any api, including REST

Read more comments on GitHub >

github_iconTop Results From Across the Web

JavaScript RangeError: Maximum Call Stack Size Exceeded
The RangeError: Maximum call stack size exceeded is thrown when a function call is made that exceeds the call stack size. This can...
Read more >
gatsby-source-contentful: Maximum call stack size exceeded
The latest change introduced with PR #20258 causes a Maximum call stack size exceeded error for me. Running gatsby develop --host 0.0.0.0 throws...
Read more >
RangeError: Maximum call stack size exceeded - Educative.io
In this shot, we will see how to fix the “RangeError: Maximum call stack size exceeded” error. ... The most common source for...
Read more >
javascript - Maximum call stack size exceeded error
It means that somewhere in your code, you are calling a function which in turn calls another function and so forth, until you...
Read more >
Node.js v19.3.0 Documentation
stack <Object> A stack trace of the function. The arrays contains information about the expected and actual number of calls of the functions...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found