-
Notifications
You must be signed in to change notification settings - Fork 45
Normalize _value to array in kol-select to handle single values #7760
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
Closed
donchi-donald
wants to merge
9
commits into
public-ui:develop
from
donchi-donald:7758-allow-single-value-in-kolselect
Closed
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
4155eb2
fix(kol-select): support single value for _value prop by normalizing …
donchi-donald cd84fb2
fix(kol-select): normalize _value to array if string or undefined (#7…
donchi-donald a8ad13f
fix(kol-select): add snapshot.spec.tsx.snap (#7758)
donchi-donald 7602a92
chore(select): clean up example by removing hardcoded _value (#7758)
donchi-donald 8059992
docs(select): simplify _value examples using string instead of array …
donchi-donald c008d7d
Merge branch 'develop' into 7758-allow-single-value-in-kolselect
donchi-donald 215fd0e
fix(kol-select): update playwright test (#7758)
donchi-donald 3ef5be5
fix(kol-select): Fix incorrect usage and placement of 'select' in cod…
donchi-donald 9fa62ec
fix(pagination): ensure page size change triggers correct event and v…
donchi-donald File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
_multiple_bringt hier einen interessanten Aspekt hinein, Gedanken dazu:1. Hintergrund zur
_multiple-Prop_multiple-Prop wird aktuell einzig dazu verwendet, das native<select>-Element mitmultipleauszustatten._multipleund dem Datentyp von_value(Single-Value vs. Array-Value).2. Typ-Ermittlung von
_value_multiplezu verlassen, sollte man besser den initialen Wert prüfen (siehekol-input-number,kol-input-date).3. Rückwärtskompatibilität
<KolSelect _value="single value" /><KolSelect _value={["array value"]} />_multipledarf dabei nicht implizit den Rückgabewert verändern, sondern sollte nur das Attribut an das native<select>weiterreichen.4. Problemfall: Kombination von
_value="single value"und_multiple<KolSelect _value="single value" _multiple />_multiplegesetzt ist.5. Mögliche Lösungsansätze
Fehler/Warnung ausgeben
_multiple={true}und_valueist kein Array, würde eine Runtime-Exception oder zumindest eine Warnung im Log erscheinen.Nur noch konsistente Kombis unterstützen (Breaking Change)
_multiple={false}→ nur Single-Value_multiple={true}→ nur Array-ValueFazit/Empfehlung
_multiplemit einem Single-Value nutzt.@deleonio @laske185 Wollt ihr hierzu noch Input geben?
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.
Vielen Dank für das ausführliche Feedback – das hilft mir, den Zusammenhang zwischen _multiple und _value jetzt deutlich besser zu verstehen. Ich sehe ein, warum eine klare Trennung bzw. konsistente Handhabung hier wichtig ist.
Ich werde die entsprechenden Anpassungen sofort vornehmen und das Verhalten entsprechend korrigieren, sodass bei Nutzung von _multiple ein Array erwartet wird bzw. zumindest eine Warnung erscheint, wenn dies nicht der Fall ist.
Danke nochmal für die Erklärung!
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.
Hi @donchi-donald
Wir haben das Thema heute morgen noch einmal im Team besprochen:
Der Konsens ist jetzt, dass doch die
_multiple-Property berücksichtigt, und sich auf den (erwarteten) _value auswirken soll. Wir wollen also praktisch den oben beschriebenen Lösungsansatz 2 umsetzen.Das heißt auch, dass wir die Validierung entsprechend anpassen müssen:
-> Ändern sich
_valueoder_multiple, muss der_valuedarauf validiert werden, dass er zur_multiple-Property passt._value={["multi"]} _multiple✅ valid_value={"single"} _multiple❌ invalid_value={"single"} _multiple={false}✅ valid_value={"single"} _multiple❌ invalidDanke für deine Geduld mit dem hin-und-her, das Ticket hätte initial besser durchdacht sein können.
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.
Hi @sdvg ,
vielen Dank für das Update und die Klarstellung.
Tatsächlich hatte ich die Lösung bereits unter Berücksichtigung des initialen Wertes implementiert. Ich verstehe nun aber, dass zusätzlich auch die _multiple-Property aktiv berücksichtigt und bei Änderungen entsprechend validiert werden soll.
Ich werde meinen Code zeitnah aktualisieren, um diese Validierungslogik mit einzubeziehen: Wenn sich _value oder _multiple ändern, wird _value so validiert, dass es konsistent zur _multiple-Property passt.
Vielen Dank nochmals für das konstruktive Feedback und die klare Richtung!
Ich passe die Lösung entsprechend an.
Beste Grüße