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

tileContent is not updated when activeStartDate changes #576

Closed
2 tasks done
akouryy opened this issue Jan 6, 2022 · 1 comment
Closed
2 tasks done

tileContent is not updated when activeStartDate changes #576

akouryy opened this issue Jan 6, 2022 · 1 comment
Labels
bug Something isn't working

Comments

@akouryy
Copy link

akouryy commented Jan 6, 2022

Before you start - checklist

  • I followed instructions in documentation written for my React-Calendar version
  • I have checked if this bug is not already reported

Description

I tried to add tile contents depending on the active month. However, the cached return value of tileContent function is not invalidated after the change of activeStartDate. As a result, some tiles are displayed as if activeStartDate were in another month.

Steps to reproduce

  1. Go to https://codesandbox.io/s/priceless-tdd-e6e7g?file=/src/App.js.
  2. Show Jan 2022. A check mark is displayed for each day in Jan.
  3. Move to Dec 2021.

Expected behavior

tileContent is re-evaluated for Dec 27th to Jan 2nd, so check marks appear in Dec 27th to 31st.

Actual behavior

Tile contents are cached and marks are still displayed for Jan 1st and 2nd.

Additional information

No response

Environment

  • Browser (if applicable): Chrome 96
  • React-Calendar version: 3.5.0
  • React version: 17.0.2
@akouryy akouryy added the bug Something isn't working label Jan 6, 2022
@akouryy akouryy changed the title tileContent is cached when activeStartDate changes tileContent is not updated when activeStartDate changes Jan 6, 2022
@wojtekmaj
Copy link
Owner

Awesome repro - thank you! This sped things up quite a bit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants