Comments (5)
In my case, when I visited the route localhost:3000/booking
for the first time, there was no error in the console( which also tricked me closing the issue ), but after that, when I started refreshing the page, the issue came up and stayed there. So I reopened the issue and wonder if there is a solution to fix it or maybe some hacky way so that I could just bypass this issue. Thanks in advance
from mui-x.
@michelengelen Thank you for your prompt reply, Sir! And by following your advice, I tested it out in Firefox, and this time there was no issue as expected, and also more weirder thing is when I switched back to the google chrome and gave it try again, the issue was not there anymore whether I turned on/off those plugins, just like what happened yesterday.
It seems this is some issue that could occur intermittently while we develop our projects as developers. So for that, please allow me to share some workarounds I found, hopefully it could help someone else who may get stuck with this sort of hydration issue during development at some point in the future:
'use client'
import React, { useState } from 'react'
import { LocalizationProvider } from '@mui/x-date-pickers';
import { AdapterDayjs } from '@mui/x-date-pickers/AdapterDayjs'
// import TestCalendar from '@/components/TestCalendar';
import dynamic from 'next/dynamic';
const ClientCalendar1 = dynamic(() => import('@/components/TestCalendar'), { ssr: false })
const ClientCalendar2 = dynamic(() => import('@/components/TestCalendar'))
export default function Booking() {
const [show, setShow] = useState(false)
return (
<LocalizationProvider dateAdapter={AdapterDayjs}>
{/* only load at the client side */}
<ClientCalendar1 />
{/* load conditionally */}
{show && <ClientCalendar2 />}
<button onClick={() => setShow(!show)}>toggle</button>
{/* <TestCalendar /> */}
</LocalizationProvider>
)
}
These workaround are Nextjs way to handle SSR, which basically help us skip SSR, so that it is ensured that we are 100% safe to use or test our components no matter what.
Okay, thanks again Sir! And my apology for any trouble caused by this wrong alarm. So I will close this issue now
from mui-x.
Now, if you have additional information related to this issue or things that could help future readers, feel free to leave a comment.
@MyNameIsTakenOMG: How did we do? Your experience with our support team matters to us. If you have a moment, please share your thoughts in this short Support Satisfaction survey.
from mui-x.
Hey @MyNameIsTakenOMG I cannot reproduce this issue.
But I can see that you have some plugins installed, right?
This can sometimes lead to weird next js bugs and should disappear when in production.
Try opening the page in a different browser or in privacy mode.
from mui-x.
Now, if you have additional information related to this issue or things that could help future readers, feel free to leave a comment.
@MyNameIsTakenOMG: How did we do? Your experience with our support team matters to us. If you have a moment, please share your thoughts in this short Support Satisfaction survey.
from mui-x.
Related Issues (20)
- [TreeView] Expose the item slots at the tree view level
- [data grid] Is Clipboard cut available? HOT 1
- [data grid] Save / Restore state with dynamic columns HOT 1
- [pickers] dayjs with default timezone broke picker HOT 2
- [pickers] Page fails to load Date Picker Component with Joy UI using CssVarsProvider Wrapper HOT 5
- [charts] Improve default color contrast in dark mode HOT 9
- [RFC] Move to a more modular structure for tests in code and CI HOT 3
- Add Audio Player/Waveform component HOT 2
- [charts] Cannot scroll the page when touch inside the chart HOT 4
- [data grid] Pivoting ETA HOT 4
- Pie Chart shows a slice for 0 value whenever the object representing a 0 is last in the array HOT 2
- [DataGrid] CSV export negative numbers in string has quotation HOT 3
- [data grid] Is there a way to override the default copy/paste functionality in DataGrid? HOT 5
- New sets of components HOT 2
- [charts] BarChart legend overlaps charts area HOT 2
- [pickers] Recipes HOT 1
- [data grid] I want to add Apply and Cancel buttons to the GridToolbarFilterButton HOT 5
- [pickers][DateTimeRangePicker] Manually selecting the date then selecting the time in the popover reverts the date to today HOT 1
- [charts] Support single color area chart HOT 4
- [data grid] Row pinning with Server-side tree data HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mui-x.