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

fix: prevent onselect event when prev, next calendar button #7155

Merged
merged 2 commits into from
Sep 12, 2024

Conversation

KumJungMin
Copy link
Contributor

@KumJungMin KumJungMin commented Sep 10, 2024

Defect Fixes


how to resolve

  • Previously, the function to trigger onSelect (onDateSelect) was executed within the updateViewDate function.
  • However, in certain conditions (such as when using the next or previous buttons), only the viewDate should change, and the currently selected date should remain unchanged.
  • To address this, I separated the onDateSelect logic(called onViewDateSelect) from the updateViewDate function.
  • Then, I added conditional calls to onViewDateSelect in the places where updateViewDate is invoked.
action condition
prevent trigger onViewDateSelect 1. when user clicked prev or next move button(navBackward(), navForward)
2. when month or year dropdown changed (onMonthDropdownChange(), onYearDropdownChange())
trigger onViewDateSelect 1. input (updateValueOnInput())
2. when today button clicked (onTodayButtonClick())
3. when month selected(onMonthSelect())
4. useUpdateEffect hook

test

prevent onselect trigger

  • when user clicked prev or next move button(under the video)
  • when month or year dropdown changed
resolved.mov

trigger onselect

  • input (updateValueOnInput())
  • when today, clear button clicked
  • when month selected

Copy link

vercel bot commented Sep 10, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

2 Skipped Deployments
Name Status Preview Comments Updated (UTC)
primereact ⬜️ Ignored (Inspect) Visit Preview Sep 10, 2024 0:33am
primereact-v9 ⬜️ Ignored (Inspect) Visit Preview Sep 10, 2024 0:33am

@KumJungMin KumJungMin marked this pull request as ready for review September 10, 2024 12:33
@melloware melloware merged commit 267e07b into primefaces:master Sep 12, 2024
5 checks passed
@KumJungMin KumJungMin deleted the fix/issue-7121 branch September 16, 2024 06:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Calendar: onSelect event triggers date change
2 participants