From 4f63c19cbaa439efb7696fcaeb5103339994e780 Mon Sep 17 00:00:00 2001 From: egordidenko Date: Mon, 12 Feb 2024 16:48:40 +0300 Subject: [PATCH] fix: rename field value to default value 1. prop defaultValue ignore after it mounting --- src/uploader.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/uploader.js b/src/uploader.js index a32cd68..206f2cc 100644 --- a/src/uploader.js +++ b/src/uploader.js @@ -19,7 +19,8 @@ const useWidget = ( { id, name, - value, + value, // @deprecated + defaultValue, onFileSelect, onChange, onDialogOpen, @@ -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 + }, []) useEffect(() => { if (uploadcare && tabsCss && typeof tabsCss === 'string') {