question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Changing resources prop does not update in render

See original GitHub issue

When the resources prop is changed, the calendar does not rerender. This is inconsistent with the way that the React flow works.

For example, if an async request is working in the background and it finishes, with a new resources array, and the render() function of the parent component is called, the calendar is not rerendered.

While the docs mention a resources function for use with ajax, this does not work with my workflow (because the information is stored in redux and used with other components), and does not align with proper React flow.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
mostlyfabulouscommented, Jun 8, 2019

@joshuaRuff I cannot post an example with codepen, jsfiddle, etc. due to the webpack requirements for FullCalendar with React. However, it is quite simple to reproduce. Render a calendar with a preset resources, then after some time, update that resources array (ex. with a button onClick). The despite the resources being changed in state the calendar will not render to reflect the updated state.

You could fork the example react fullcalendar example here https://codesandbox.io/s/2z6wp2jozn) to reproduce the issue?

0reactions
ziaulrehman40commented, Jun 5, 2020

~~In my case it is actually throwing error https://github.com/fullcalendar/fullcalendar-scheduler/issues/527#issuecomment-639452902~~

When resources change from empty array to something else(useeffect fetches data and populates)

UPDATE: NVM, our old code had logical bug which was passing null resources instead of [] in one case, and next time resources were sent it started throwing this error. Fixed by passing [] if no resources.

Read more comments on GitHub >

github_iconTop Results From Across the Web

React props not updating - Stack Overflow
I have a parent class component that has a function in componentWillMount that loops through a list of strings and creates an element...
Read more >
How to update a component's prop in ReactJS — oh yes, it's ...
Props are never to be updated. We are to use them as is. Sounds rigid right? But React has its reasons behind this...
Read more >
Why React Child Components Don't Update on Prop Changes
In React, it's a common problem to have child components that don't re- render when you expect them to. In particular, a common...
Read more >
Learn how to force react components to rerender without ...
React components re-render on their own whenever there are some changes in their props or state. Simply updating the state, from a random ......
Read more >
React.Component
An update can be caused by changes to props or state. ... The render() function should be pure, meaning that it does not...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found