-
Notifications
You must be signed in to change notification settings - Fork 26
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
Update selectable search input state when the input changes #2776
Update selectable search input state when the input changes #2776
Conversation
🦋 Changeset detectedLatest commit: 12d6909 The changes in this PR will be included in the next version bump. This PR includes changesets to release 96 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
To be honest, I have mixed feelings with this. The I think we're mixing both strategies here. My proposal would be to have both What do others think about it? @commercetools/shield-team-fe |
updated here: be21255 |
Thanks @ddouglasz However, I still would like to read the rest of the team point of view about this. cc/ @commercetools/shield-team-fe |
That makes sense and this may likely be a breaking change. |
I agree with the proposed changes. Introducing both |
Thanks for checking with the team.
This proposal makes sense to me and this approach is justified in my opinion |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From my side, I'm also good with having the two props. Thanks for the proposal / fix!
/** | ||
* Default value of the input. Consists of text input and selected option. | ||
*/ | ||
defaultValue: TValue; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this supposed to be a required field?
If yes, it should probably be considered a breaking change.
If not, it should be handled as an optional field.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh true, seems to me like it should be optional, assuming we do not expect users to always provide a default value.
The initial implementation already sets it to an empty string in the absence of a default value.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The problem I see is that we currently only have the value
property but we're actually using it as default value.
If we now change the behaviour of the already exposed value
property to drive the internal state and add the new defaultValue
, all current consumers will be affected so hence this would be a breaking change as Nicola mentioned.
We need to double think if we can somehow come up with a solution that can avoid the breaking change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nicola and I had a conversation about this and we agreed releasing a major ui-kit
version just for this change currently is not convenient.
Although the long term solution is having both a defaultValue
and a value
properties to handle both controlled and uncontrolled states, we think it could benefit us to hold that change until we have a better reason to release a breaking change version.
What we can do in the meantime is to introduce a new temporary property (example: experimentalValue
) that can be used for the controlled version of the component. Then, we will have the two properties that we need, but with the "wrong" names and at least we will have a escape hatch for those (very few) use cases we know so far that require the controlled version of the component.
Once we get to the point when it will be convenient to release an ui-kit
major version, we will rename those properties and probably publish a codemod which consumers can run in their codebase, to migrate from one names to the others automatically.
All recent feedback updated here: 3a3bb9d |
packages/components/inputs/selectable-search-input/src/selectable-search-input.spec.tsx
Show resolved
Hide resolved
@CarlosCortizasCT PR updated based on our last discussion here : 5d1edea Thank you. |
packages/components/inputs/selectable-search-input/src/selectable-search-input.tsx
Outdated
Show resolved
Hide resolved
packages/components/inputs/selectable-search-input/src/selectable-select.tsx
Show resolved
Hide resolved
I think we still need to update the Storybook story. As discussed last week, currently it's implemented as if it's controlling the state of the component where it is not. Also, now that we've introduced a new function called |
I also was wondering if the last change we've introduced with managing the dropdown option could be a breaking change for current consumers. |
Great point 💯 |
updated here: c0e73a3 |
Summary
Update selectable search input state when the input changes
Closes #2773