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(ui-date-time-input): fix DateTimeInput displaying wrong value of its value is changed in a onChange callback #1829

Merged
merged 2 commits into from
Dec 17, 2024

Conversation

matyasf
Copy link
Collaborator

@matyasf matyasf commented Dec 16, 2024

Closes: INSTUI-4406

I could only reproduce it in CodeSandbox, but according to React documentation setState is not synchronous so the results are not deterministic.

TEST PLAN:
Enter '2' to the date input here: https://codesandbox.io/p/sandbox/stupefied-almeida-d8qxtr observe that the DateTimeInput's message field displays the correct date.
Change the dependency to InstUI 10.9.0, reload the preview and do the same. DateTimeInput's value should be wrong

…its value is changed in a onChange callback

Closes: INSTUI-4406

I could only repropduce it in CodeSandbox, but according to React documentation setState is not
synchronous so the results are not deterministic
TEST PLAN:
Make a DateTimeInput whose value changes in an onChange listerer on CodeSandbox. It should update
properly
@matyasf matyasf self-assigned this Dec 16, 2024
Copy link

github-actions bot commented Dec 16, 2024

PR Preview Action v1.4.8
Preview removed because the pull request was closed.
2024-12-17 17:22 UTC

@matyasf matyasf requested review from balzss and HerrTopi December 16, 2024 21:23
Copy link
Contributor

@HerrTopi HerrTopi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@matyasf matyasf merged commit b52ff30 into master Dec 17, 2024
10 of 11 checks passed
@matyasf matyasf deleted the datetimeinput_onchange_fix branch December 17, 2024 17:22
matyasf added a commit that referenced this pull request Dec 19, 2024
…its value is changed in a onChange callback

Closes: INSTUI-4406

I could only repropduce it in CodeSandbox, but according to React documentation setState is not
deterministic. Backport of PR #1829 from InstUI v10
TEST PLAN:
Make a DateTimeInput whose value changes in an onChange listerer on CodeSandbox. It should update
properly
matyasf added a commit that referenced this pull request Dec 19, 2024
…its value is changed in a onChange callback

Closes: INSTUI-4406

I could only repropduce it in CodeSandbox, but according to React documentation setState is not
deterministic. Backport of PR #1829 from InstUI v10
TEST PLAN:
Make a DateTimeInput whose value changes in an onChange listerer on CodeSandbox. It should update
properly
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.

3 participants