Skip to content

Commit 4f63c19

Browse files
author
egordidenko
committed
fix: rename field value to default value
1. prop defaultValue ignore after it mounting
1 parent d2cce69 commit 4f63c19

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/uploader.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ const useWidget = (
1919
{
2020
id,
2121
name,
22-
value,
22+
value, // @deprecated
23+
defaultValue,
2324
onFileSelect,
2425
onChange,
2526
onDialogOpen,
@@ -167,11 +168,11 @@ const useWidget = (
167168
}, [widgetOptions])
168169

169170
useEffect(() => {
170-
if (cachedValueRef.current !== value) {
171-
widget.current.value(value)
171+
if (cachedValueRef.current !== defaultValue) {
172+
widget.current.value(defaultValue)
172173
}
173-
cachedValueRef.current = value
174-
}, [value])
174+
cachedValueRef.current = defaultValue
175+
}, [])
175176

176177
useEffect(() => {
177178
if (uploadcare && tabsCss && typeof tabsCss === 'string') {

0 commit comments

Comments
 (0)