Skip to content
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

React warning with JSX eventContent "flushSync was called from inside a lifecycle method" #7334

Closed
1 task done
AmruthPillai opened this issue May 16, 2023 · 9 comments
Closed
1 task done

Comments

@AmruthPillai
Copy link

Reduced Test Case

Do you understand that if a reduced test case is not provided, we will intentionally delay triaging of your ticket?

  • I understand

Which connector are you using (React/Angular/etc)?

React

Bug Description

When I updated to the latest version v6.1.7, started facing this issue.

There's no visual bug, but I keep getting this warning fired many times when the calendar view updates.

Warning: flushSync was called from inside a lifecycle method. React cannot flush when React is already rendering. Consider moving this call to a scheduler task or micro task.

Screenshot 2023-05-16 at 2 13 53 PM

@walerun
Copy link

walerun commented May 17, 2023

the same for me 🤔

@cbaconnier
Copy link

cbaconnier commented May 17, 2023

Happening to me as well on React.
For me it seems to come from eventContent.

  const renderEventContent = (eventInfo: EventContentArg) => {
    return (
      <div>{/* ... */}</div>
    )
  }

// ...

<FullCalendar
    eventContent={renderEventContent}
/>

Edit: Seems that "fix unnecessary calls to eventContent" in the latest release was necessary after all 😅
https://github.com/fullcalendar/fullcalendar/releases/tag/v6.1.7

@Arithmetics
Copy link

same for me

@acerix
Copy link
Member

acerix commented May 18, 2023

Would you be able to post a runnable, stripped-down demonstration of the bug? Would really appreciate it because the time saved reproducing will be time spent fixing.

The React example project uses eventContent like that but I don't see any warning:

https://stackblitz.com/github/fullcalendar/fullcalendar-examples/tree/main/react

@acerix acerix closed this as completed May 18, 2023
@cbaconnier
Copy link

cbaconnier commented May 18, 2023

Would you be able to post a runnable, stripped-down demonstration of the bug? Would really appreciate it because the time saved reproducing will be time spent fixing.

The React example project uses eventContent like that but I don't see any warning:

https://stackblitz.com/github/fullcalendar/fullcalendar-examples/tree/main/react

@acerix
This is what I see in the console when I run your example and click on toggle weekends.

Also, as I said earlier, as soon as we remove eventContent={renderEventContent} the error is gone.

image

@acerix acerix changed the title Warning: flushSync was called from inside a lifecycle method. React cannot flush when React is already rendering. Consider moving this call to a scheduler task or micro task. Warning: flushSync was called from inside a lifecycle method. React cannot flush when React is already rendering. May 19, 2023
@acerix
Copy link
Member

acerix commented May 19, 2023

Thanks for the info, I also see the warning after toggle weekends.

@acerix acerix reopened this May 19, 2023
@acerix acerix changed the title Warning: flushSync was called from inside a lifecycle method. React cannot flush when React is already rendering. React warning with JSX eventContent "flushSync was called from inside a lifecycle method" May 19, 2023
@arshaw arshaw added this to the next-release milestone May 22, 2023
@RomOleg
Copy link

RomOleg commented May 24, 2023

Same with "resourceAreaColumns" when you specify cellContent: () => { return ( MyComponent ) }
image

@gursidak
Copy link

one more clue this warning is logged the same number of time as the lenght of events array, sometimes in its multiple, like if 101 events are supplied, it will log 101 times this warning, in my case when i drag to select range of dates, it logs this warning "length of events array" times .

@arshaw
Copy link
Member

arshaw commented May 25, 2023

This is now fixed in v6.1.8

Updated repro:
https://stackblitz.com/edit/github-bv3xxu?file=package.json

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants