Skip to content

Commit

Permalink
Update packages/react/src/components/primitive/root.tsx
Browse files Browse the repository at this point in the history
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
  • Loading branch information
veloii and coderabbitai[bot] authored Oct 23, 2024
1 parent b140b50 commit 7d38176
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions packages/react/src/components/primitive/root.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ export function Root<
if (mode === "auto") void uploadFiles(filesToUpload);
});

const primitiveValues: PrimitiveContextValues = {
const primitiveValues = useMemo<PrimitiveContextValues>(() => ({
files,
setFiles: (files) => {
setFiles(files);
Expand Down Expand Up @@ -289,7 +289,18 @@ export function Root<
fileInputRef,
},
routeConfig,
};
}), [
files,
setFiles,
uploadFiles,
uploadProgress,
state,
accept,
fileTypes,
mode,
multiple,
routeConfig,
]);

return (
<PrimitiveContext.Provider value={primitiveValues}>
Expand Down

0 comments on commit 7d38176

Please sign in to comment.