mirror of
https://github.com/nextui-org/nextui.git
synced 2025-12-08 19:26:11 +00:00
Fix/input undefined value (#1369)
* fix(input): undefined value uncontrolled * fix(input): undefined value uncontrolled
This commit is contained in:
parent
e6c3747153
commit
abe1ba58de
5
.changeset/shaggy-moles-tan.md
Normal file
5
.changeset/shaggy-moles-tan.md
Normal file
@ -0,0 +1,5 @@
|
||||
---
|
||||
"@nextui-org/input": patch
|
||||
---
|
||||
|
||||
fix #1332 undefined value removed from input value
|
||||
@ -13,12 +13,12 @@ const removeIgnoredFiles = async (files) => {
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
"**/*.{cjs,mjs,js,ts,jsx,tsx}": async (files) => {
|
||||
"**/*.{js,ts,jsx,tsx}": async (files) => {
|
||||
const filesToLint = await removeIgnoredFiles(files);
|
||||
|
||||
return [`eslint -c .eslintrc.json --max-warnings=0 --fix ${filesToLint}`];
|
||||
},
|
||||
"**/*.{css,json,md}": async (files) => {
|
||||
"**/*.css": async (files) => {
|
||||
const filesToLint = await removeIgnoredFiles(files);
|
||||
|
||||
return [`prettier --config .prettierrc.json --ignore-path --write ${filesToLint}`];
|
||||
|
||||
@ -94,8 +94,8 @@ export function useInput<T extends HTMLInputElement | HTMLTextAreaElement = HTML
|
||||
);
|
||||
|
||||
const [inputValue, setInputValue] = useControlledState<string | undefined>(
|
||||
props.value ?? undefined,
|
||||
props.defaultValue ?? undefined,
|
||||
props.value,
|
||||
props.defaultValue,
|
||||
handleValueChange,
|
||||
);
|
||||
|
||||
@ -125,7 +125,7 @@ export function useInput<T extends HTMLInputElement | HTMLTextAreaElement = HTML
|
||||
originalProps?.placeholder,
|
||||
),
|
||||
inputElementType: isMultiline ? "textarea" : "input",
|
||||
value: inputValue,
|
||||
value: inputValue ?? "",
|
||||
onChange: setInputValue,
|
||||
},
|
||||
domRef,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user