While working on the code, I encountered some strange errors which resulted in an undefined pageContext. The error was caused earlier on in middleware, but the undefined pageContext was crashing the server before the real error message could even get to the browser to be displayed.
While searching for a solution, I found what I believe was the upstream for your _dashboard file, but with fixes for the errors I was encountering. I've also included more upstream code from _app that should probably be included, and deferred the themeColor in a similar way to the css.
While working on the code, I encountered some strange errors which resulted in an undefined pageContext. The error was caused earlier on in middleware, but the undefined pageContext was crashing the server before the real error message could even get to the browser to be displayed.
While searching for a solution, I found what I believe was the upstream for your _dashboard file, but with fixes for the errors I was encountering. I've also included more upstream code from _app that should probably be included, and deferred the themeColor in a similar way to the css.
upstream: https://github.com/mui-org/material-ui/tree/master/examples/nextjs