Skip to content

Commit

Permalink
fix: rename field value to default value
Browse files Browse the repository at this point in the history
1. prop defaultValue ignore after it mounting
  • Loading branch information
egordidenko committed Feb 13, 2024
1 parent d2cce69 commit 4f63c19
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/uploader.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ const useWidget = (
{
id,
name,
value,
value, // @deprecated
defaultValue,
onFileSelect,
onChange,
onDialogOpen,
Expand Down Expand Up @@ -167,11 +168,11 @@ const useWidget = (
}, [widgetOptions])

useEffect(() => {
if (cachedValueRef.current !== value) {
widget.current.value(value)
if (cachedValueRef.current !== defaultValue) {
widget.current.value(defaultValue)
}
cachedValueRef.current = value
}, [value])
cachedValueRef.current = defaultValue
}, [])

Check warning on line 175 in src/uploader.js

View workflow job for this annotation

GitHub Actions / build

React Hook useEffect has a missing dependency: 'defaultValue'. Either include it or remove the dependency array

useEffect(() => {
if (uploadcare && tabsCss && typeof tabsCss === 'string') {
Expand Down

0 comments on commit 4f63c19

Please sign in to comment.