Open eddiekoh opened 3 years ago
Hello there, @eddiekoh ,
Thank you for your interest in working with our products. You access an inexistent route, please, instead of
/
at the endThis will solve your issue.
Best, Manu
Thanks for the fast reply @EINazare ,
NextJS will do a redirect http://localhost:3000/admin/dashboard/ to http://localhost:3000/admin/dashboard if you try on other page that didn't use ./variables/charts.js then the redirect will happen.
if (typeof window === "undefined") { global.window = {}; } if (typeof document === "undefined") { global.document = { querySelector: () => {}, }; }
This block us causing error with NextJS
Hello again, @eddiekoh ,
Go inside pages/admin/dashboard.js
and change:
<Line
data={chartExample1[chartExample1Data]}
options={chartExample1.options}
id="chart-sales-dark"
className="chart-canvas"
/>
To:
{
typeof window !== "undefined" && <Line
data={chartExample1[chartExample1Data]}
options={chartExample1.options}
id="chart-sales-dark"
className="chart-canvas"
/>
}
And also, change:
<Bar
data={chartExample2.data}
options={chartExample2.options}
className="chart-canvas"
id="chart-bars"
/>
To:
{
typeof window !== "undefined" && <Bar
data={chartExample2.data}
options={chartExample2.options}
className="chart-canvas"
id="chart-bars"
/>
}
This will do the trick.
NOTE: Everywhere we use the chart.js
and react-chartjs-2
you will need to add that:
{
typeof window !== "undefined" && ...render code of chart here
}
Best, Manu
Thanks, this will fix my issue since I'm not using the demo chart.
Version
1.1.0
Reproduction link
https://www.creative-tim.com/product/nextjs-argon-dashboard-pro
Operating System
MacOS
Device
Laptop
Browser & Version
All Browser
Steps to reproduce
What is expected?
Expect the mage to be redirected to http://localhost:3000/admin/dashboard
What is actually happening?
it is showing error instead
Solution
Additional comments