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

[BUG]: Calendar OnChange is triggered automatically at the first visibility! #310

Closed
nelson-yan opened this issue Mar 24, 2023 · 2 comments
Labels
bug Something isn't working Component: Calendar 👋 needs author feedback Waiting on a response from the author

Comments

@nelson-yan
Copy link

Describe the bug

Calendar OnChange is triggered automatically at the first visibility!

To Reproduce
Steps to reproduce the behavior:

Add a textinput box and Calendar componet in screen, set propertie as below. When I first click on textbox it briefly displays the calendar then immediately hides, the notification pop up as well. It is obviously OnChange event is fired automatically at the first visibility!

txtSelectedDate.OnSelect: UpdateContext({varShowCal:!varShowCal})
Calendar.OnChange: Notify("Calendar OnChange Fired!");UpdateContext({varShowCal:false})
datePicker.OnVisible: varShowCal

Expected behavior
Calendar.OnChange won't be triggered automatically at the first visibility!

Screenshots

Additional context
Community Post: https://powerusers.microsoft.com/t5/Building-Power-Apps/Creator-Kit-Date-Picker-Hide-OnChange/td-p/1910923

@nelson-yan nelson-yan added bug Something isn't working ⚠️ needs triage Has not been triaged by the team yet. labels Mar 24, 2023
@denise-msft
Copy link
Member

denise-msft commented May 10, 2023

A similar issue was raised and a workaround was provided - can you please try using the suggested resolution by adding a context variable to control the behavior past an init state? See #213

As a workaround, you can try adding an additional context variable that covers this first load situation:
Screen.OnVisible:
UpdateContext({ init: true })

Calendar1.OnChange:

If( init,
    UpdateContext({ init: false }),
    UpdateContext({ varShowCal: false }); /* Else action expression can be whatever you wanted onChange to do */
)

@denise-msft denise-msft added 👋 needs author feedback Waiting on a response from the author Component: Calendar and removed ⚠️ needs triage Has not been triaged by the team yet. labels May 10, 2023
@nelson-yan
Copy link
Author

Yes, I did something similiar as mitigation.

Ramakrishnan24689 added a commit to microsoft/powercat-code-components that referenced this issue Aug 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Component: Calendar 👋 needs author feedback Waiting on a response from the author
Projects
None yet
Development

No branches or pull requests

2 participants