From ea102b25f577be5f4190a8bacc5b45de6a9059e0 Mon Sep 17 00:00:00 2001
From: Jose Manuel Serrano Amaut <a20122128@pucp.pe>
Date: Sun, 12 Mar 2023 11:37:42 -0500
Subject: [PATCH] [FIX]: Fix infinite buble when value is not given. Solution
 was to use the default value

---
 .../components/dropzone/components/dropzone/Dropzone.tsx   | 1 +
 .../dropzone/components/dropzone/DropzoneProps.ts          | 7 ++++---
 .../components/file-input-button/InputButtonProps.ts       | 3 ++-
 src/files-ui/hooks/useDropzoneFileUpdater.ts               | 3 +++
 4 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/src/files-ui/components/dropzone/components/dropzone/Dropzone.tsx b/src/files-ui/components/dropzone/components/dropzone/Dropzone.tsx
index a5d4d61..7ff135c 100644
--- a/src/files-ui/components/dropzone/components/dropzone/Dropzone.tsx
+++ b/src/files-ui/components/dropzone/components/dropzone/Dropzone.tsx
@@ -91,6 +91,7 @@ const Dropzone: React.FC<DropzoneProps> = (props: DropzoneProps) => {
     ...rest
   } = mergeProps(props, defaultDrozoneProps);
   console.log("Dropzone props", children);
+  console.log("Dropzone value", value);
   const {
     url,
     method,
diff --git a/src/files-ui/components/dropzone/components/dropzone/DropzoneProps.ts b/src/files-ui/components/dropzone/components/dropzone/DropzoneProps.ts
index 030c70a..bba187d 100644
--- a/src/files-ui/components/dropzone/components/dropzone/DropzoneProps.ts
+++ b/src/files-ui/components/dropzone/components/dropzone/DropzoneProps.ts
@@ -287,10 +287,10 @@ export type DropzoneAdvancedConfig = {
 
 
 type DefDivProps = React.HTMLProps<HTMLDivElement>;
-type DivPropsOmitInputButtonFullProps = Omit<DefDivProps,  keyof DropzoneFullProps>;
+type DivPropsOmitDropzoneFullProps = Omit<DefDivProps, keyof DropzoneFullProps>;
 
 export declare type DropzoneProps =
-DivPropsOmitInputButtonFullProps &
+  DivPropsOmitDropzoneFullProps &
   {
     [D in keyof DropzoneFullProps]: DropzoneFullProps[D]
   }
@@ -305,5 +305,6 @@ export const defaultDrozoneProps: DropzoneProps =
   uploadConfig: {},
   actionButtons: {},
   header: true,
-  footer: true
+  footer: true,
+  value: [],
 }
\ No newline at end of file
diff --git a/src/files-ui/components/file-input-button/InputButtonProps.ts b/src/files-ui/components/file-input-button/InputButtonProps.ts
index d56f018..fd729e5 100644
--- a/src/files-ui/components/file-input-button/InputButtonProps.ts
+++ b/src/files-ui/components/file-input-button/InputButtonProps.ts
@@ -142,9 +142,10 @@ export declare type FileInputButtonProps =
 export const defaultFileInputButtonProps: FileInputButtonProps =
 {
     textDecoration: "uppercase",
-    label:"browse...",
+    label: "browse...",
     behaviour: "add",
     disabled: false,
     uploadConfig: {},
     actionButtons: {},
+    value: [],
 }
\ No newline at end of file
diff --git a/src/files-ui/hooks/useDropzoneFileUpdater.ts b/src/files-ui/hooks/useDropzoneFileUpdater.ts
index b1bb4dd..a776c66 100644
--- a/src/files-ui/hooks/useDropzoneFileUpdater.ts
+++ b/src/files-ui/hooks/useDropzoneFileUpdater.ts
@@ -25,6 +25,9 @@ const useDropzoneFileListUpdater = (
     localization?: Localization,
     validateFilesFlag?: boolean
 ): [ExtFile[], number, React.Dispatch<React.SetStateAction<ExtFile[]>>] => {
+
+    console.log("FileListUpdater",dropzoneId, value, isUploading, maxFileSize, accept, maxFiles, validateFilesFlag);
+
     //state for managing the files locally
     const [localFiles, setLocalFiles] = React.useState<ExtFile[]>([]);
     // the current number of valid files
-- 
GitLab