Skip to content

Fix TimeSelect showing the wrong value when defaultValue is set and entering a wrong value after a good one#1871

Merged
matyasf merged 1 commit intomasterfrom
timeSelect_defaultValue_fix
Feb 21, 2025
Merged

Fix TimeSelect showing the wrong value when defaultValue is set and entering a wrong value after a good one#1871
matyasf merged 1 commit intomasterfrom
timeSelect_defaultValue_fix

Conversation

@matyasf
Copy link
Collaborator

@matyasf matyasf commented Feb 13, 2025

TimeSelect was resetting to its defaultValue after a valid value was set if entering an invalid value. This commit fixes it by not losing the selected option ID when the input changes

Testing the fix:

Enter the following code:

<TimeSelect
        renderLabel="Choose a time"
        placeholder="e.g., 4:00:00 PM"
        defaultValue="2020-05-18T22:00:00"
        step={15}
        onChange={(e, { value }) => console.log(value)}
        format="LTS"
      />
  1. select a different time than the defaultValue
  2. click into the input field, delete the value inside until there are multiple options shown and click outside/tab away. It should display the value you selected previously. There should be no change event emitted

Fixes INSTUI-4451

…ultValue is set and enteting a wrong value after a good one

TimeSelect was resetting to its defaultValue after a valid value was set if entering an invalid
value. This commit fixes it by not losing the selected option ID when the input changes

INSTUI-4451
@matyasf matyasf requested review from HerrTopi and ToMESSKa February 13, 2025 19:56
@matyasf matyasf self-assigned this Feb 13, 2025
@matyasf matyasf changed the title fix(ui-time-select): fix TimeSelect showing the wrong value when defaultValue is set and entering a wrong value after a good one Fix TimeSelect showing the wrong value when defaultValue is set and entering a wrong value after a good one Feb 13, 2025
@github-actions
Copy link

github-actions bot commented Feb 13, 2025

PR Preview Action v1.6.0
Preview removed because the pull request was closed.
2025-02-21 13:00 UTC

@balzss balzss self-requested a review February 17, 2025 09:56
@HerrTopi HerrTopi removed the request for review from balzss February 21, 2025 12:54
@matyasf matyasf merged commit 9d28a3b into master Feb 21, 2025
11 checks passed
@matyasf matyasf deleted the timeSelect_defaultValue_fix branch February 21, 2025 13:00
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