New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Firing calendarApi inside useEffect could cause 'flushSync was called from inside a lifecycle method' #7448
Comments
Same error here. Is there any workaroud ? |
This seems to be directly related to the issue they attempted to fix in 6.1.8. If you set your |
@eiji03aero , I'm doing a bugfix release this week and I'll investigate the root cause of this |
@arshaw |
I fixed has been release in v6.1.9 This completely fixes the problem for React 16 (what @eiji03aero) is using and 17. However, in React 18 or higher, people still might see a (non-fatal) warning. In order to completely fix this, we'll need to refactor the way the connector system works with custom-content injection, which is planned for v7. |
@arshaw |
Thanks @eiji03aero I will leave this ticket open until it is properly fixed in v7 |
We're having the same issue using React 18. What version is this bug introduced? So we can downgrade in the meantime |
@Gatix, are you seeing a warning or a fatal error? |
My bad it's just a bug in our code where I was quick to blame the library, just a warning on our end.. |
I also ran into this warning on React 18 while trying to call useEffect(() => {
queueMicrotask(() => {
calendar.setOption(/* ... */)
})
}, []) |
Nice workaround |
Is there some future plan to get rid of this warning as well without the need of using workarounds? |
Reduced Test Case
https://stackblitz.com/edit/github-bv3xxu-3q3ump?file=src%2FDemoApp.jsx
Do you understand that if a reduced test case is not provided, we will intentionally delay triaging of your ticket?
Which connector are you using (React/Angular/etc)?
React
Bug Description
General
Using packages with version 6.1.8.
It seems to be when calendarApi like
gotoDate
orbatchRendering
is called inside React.useEffect, it crashes the page by causing an errorflushSync was called from inside a lifecycle method
.You can reproduce this by clicking the either of
prev date
ornext date
button in sidebar of my reduced test case.I though this could be solved by using
6.1.8
as I found a similar issue like this one (#7334), but it did not help.It seems to be there are other problem in working with React.
About the reduced test case
I have tried to reproduce my project's implementation as much as possible, though there are codes that seem to be odd.
Points of this implementation would be:
Expectation
Calling calendar apis inside React.useEffect without crashing the page.
Misc
The text was updated successfully, but these errors were encountered: