Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 3d2b401

Browse files
author
egordidenko
committedFeb 12, 2024·
fix: rename field value to default value
1. prop defaultValue ignore after it mounting
1 parent d2cce69 commit 3d2b401

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed
 

‎src/uploader.js

+6-5
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)
Please sign in to comment.