fullcalendar / fullcalendar-react

The official React Component for FullCalendar

Home Page:https://fullcalendar.io/docs/react

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Event function calls calls when any state farther up the tree changes

kevin-ashton opened this issue · comments

Reduced Test Case

  1. Create barebone app
  2. The widget calls the fetch event function so that it can crash.

CodeSandbox Example

Bug Description

I am using the calendar event function and anytime I change state farther up the tree it triggers the function again. The state is not related to the calendar and ideally I don't want it to run unless I manually trigger it.

This is particularly problematic if I want to tie into the loading function and show/hide a spinner. It basically kicks off an infinite reload. In the example you can uncomment the loading code it will trigger an infinite loop and crash the JS thread.

I very easily be doing something wrong. Basically I'm confused on

a) Why does the calendar fetch the data every-time any state changes?
b) How are you supposed to use the loading function. If I store its state somewhere it will trigger an infinite loop.

Screenshots

image

I believe this existing ticket captures this need:
fullcalendar/fullcalendar#7066

Please visit the above issue, give a 👍 to vote (?), press the 🔈Subscribe button to receive updates.

So to avoid the loop with loading, the state should not be modified from there, you could instead use a separate component for the spinner and update it's state instead.