const store = initStore({
ctx: appCtx.ctx, // <= causes circular reference
});
...
return {
isServer,
initialState: store.getState(), // because initialState includes ctx
initialProps,
};
this is the warning i see (nexjs 9)
(node:98926) UnhandledPromiseRejectionWarning: TypeError: Converting circular structure to JSON
at JSON.stringify (<anonymous>)
at /Workspace/github/andycmaj/musigraph-next/node_modules/webpack-hot-middleware/middleware.js:111:38
at /Workspace/github/andycmaj/musigraph-next/node_modules/webpack-hot-middleware/middleware.js:66:7
at Array.forEach (<anonymous>)
at everyClient (/Workspace/github/andycmaj/musigraph-next/node_modules/webpack-hot-middleware/middleware.js:65:26)
at Object.publish (/Workspace/github/andycmaj/musigraph-next/node_modules/webpack-hot-middleware/middleware.js:110:7)
at Function.middleware.publish (/Workspace/github/andycmaj/musigraph-next/node_modules/webpack-hot-middleware/middleware.js:48:17)
at HotReloader.send.args [as send] (/Workspace/github/andycmaj/musigraph-next/node_modules/next/dist/server/hot-reloader.js:6:335)
at /Workspace/github/andycmaj/musigraph-next/node_modules/next/dist/server/hot-reloader.js:16:376
at typePromise.then.typeMessages (/Workspace/github/andycmaj/musigraph-next/node_modules/next/dist/build/output/index.js:2:133)
at process._tickCallback (internal/process/next_tick.js:68:7)
(node:98926) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 11)
this line:
this is the warning i see (nexjs 9)
when i comment out
the warning goes away