mirror of
https://github.com/terribleplan/next.js.git
synced 2024-01-19 02:48:18 +00:00
b3045cc7a9
* Implement circular JSON err.sh link * Add test for getInitialProps returning circular json * Make test warn less * Fix tests * Add reference to original tests
12 lines
494 B
Markdown
12 lines
494 B
Markdown
# Circular structure in "getInitialProps" result
|
|
|
|
#### Why This Error Occurred
|
|
|
|
`getInitialProps` is serialized to JSON using `JSON.stringify` and sent to the client side for hydrating the page.
|
|
|
|
However, the result returned from `getInitialProps` can't be serialized when it has a circular structure.
|
|
|
|
#### Possible Ways to Fix It
|
|
|
|
Circular structures are not supported, so the way to fix this error is removing the circular structure from the object that is returned from `getInitialProps`.
|