Skip to content

Commit e2a2179

Browse files
authored
Merge pull request #115 from lambda-curry/fix-input-select
Fix input select
2 parents a6f40ad + c7ad82d commit e2a2179

File tree

2 files changed

+21
-3
lines changed

2 files changed

+21
-3
lines changed

packages/ui-components/src/lib/inputs/InputSelect/InputSelect.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,8 @@ export const InputSelect: FC<InputSelectProps> = ({
173173
// Note: We had to use a `useEffect` here to handle cases where the form is reset or manipulated outside of the input
174174
// For some reason setting the initialInputValue in the initial useState did not reset the input on a form reset
175175
useEffect(() => {
176+
if (_isEqual(controlledValue, value)) return;
177+
176178
setValue(controlledValue);
177179
}, [controlledValue]);
178180

@@ -298,9 +300,10 @@ export const InputSelect: FC<InputSelectProps> = ({
298300
// Allows the input to keep it's value when the user selects an option when disableCloseOnSelect is true
299301
if (isMultiselect && autocompleteProps.disableCloseOnSelect) {
300302
autocompleteProps.inputValue = inputValue;
303+
const existingOnBlur = autocompleteProps.onBlur;
301304
autocompleteProps.onBlur = event => {
302-
setInputValue('');
303-
if (autocompleteProps.onBlur) autocompleteProps.onBlur(event);
305+
if (inputValue) setInputValue('');
306+
if (existingOnBlur) existingOnBlur(event);
304307
};
305308
}
306309

yarn.lock

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16743,13 +16743,20 @@ postcss-modules@^4.0.0:
1674316743
postcss-modules-values "^4.0.0"
1674416744
string-hash "^1.1.1"
1674516745

16746-
postcss-nested@*, postcss-nested@6.0.0, postcss-nested@^6.0.0:
16746+
postcss-nested@*, postcss-nested@6.0.0:
1674716747
version "6.0.0"
1674816748
resolved "https://registry.yarnpkg.com/postcss-nested/-/postcss-nested-6.0.0.tgz#1572f1984736578f360cffc7eb7dca69e30d1735"
1674916749
integrity sha512-0DkamqrPcmkBDsLn+vQDIrtkSbNkv5AD/M322ySo9kqFkCIYklym2xEmWkwo+Y3/qZo34tzEPNUw4y7yMCdv5w==
1675016750
dependencies:
1675116751
postcss-selector-parser "^6.0.10"
1675216752

16753+
postcss-nested@^6.0.1:
16754+
version "6.0.1"
16755+
resolved "https://registry.yarnpkg.com/postcss-nested/-/postcss-nested-6.0.1.tgz#f83dc9846ca16d2f4fa864f16e9d9f7d0961662c"
16756+
integrity sha512-mEp4xPMi5bSWiMbsgoPfcP74lsWLHkQbZc3sY+jWYd65CUwXrUaTp0fmNpa01ZcETKlIgUdFN/MpS2xZtqL9dQ==
16757+
dependencies:
16758+
postcss-selector-parser "^6.0.11"
16759+
1675316760
postcss-normalize-charset@^5.0.1:
1675416761
version "5.0.1"
1675516762
resolved "https://registry.yarnpkg.com/postcss-normalize-charset/-/postcss-normalize-charset-5.0.1.tgz#121559d1bebc55ac8d24af37f67bd4da9efd91d0"
@@ -16987,6 +16994,14 @@ postcss-selector-parser@^6.0.10:
1698716994
cssesc "^3.0.0"
1698816995
util-deprecate "^1.0.2"
1698916996

16997+
postcss-selector-parser@^6.0.11:
16998+
version "6.0.13"
16999+
resolved "https://registry.yarnpkg.com/postcss-selector-parser/-/postcss-selector-parser-6.0.13.tgz#d05d8d76b1e8e173257ef9d60b706a8e5e99bf1b"
17000+
integrity sha512-EaV1Gl4mUEV4ddhDnv/xtj7sxwrwxdetHdWUGnT4VJQf+4d05v6lHYZr8N573k5Z0BViss7BDhfWtKS3+sfAqQ==
17001+
dependencies:
17002+
cssesc "^3.0.0"
17003+
util-deprecate "^1.0.2"
17004+
1699017005
postcss-selector-parser@^6.0.9:
1699117006
version "6.0.10"
1699217007
resolved "https://registry.yarnpkg.com/postcss-selector-parser/-/postcss-selector-parser-6.0.10.tgz#79b61e2c0d1bfc2602d549e11d0876256f8df88d"

0 commit comments

Comments
 (0)