diff --git a/packages/react/src/components/primitive/root.tsx b/packages/react/src/components/primitive/root.tsx index e85af2539..e620c4f94 100644 --- a/packages/react/src/components/primitive/root.tsx +++ b/packages/react/src/components/primitive/root.tsx @@ -260,7 +260,7 @@ export function Root< if (mode === "auto") void uploadFiles(filesToUpload); }); - const primitiveValues: PrimitiveContextValues = { + const primitiveValues = useMemo(() => ({ files, setFiles: (files) => { setFiles(files); @@ -289,7 +289,18 @@ export function Root< fileInputRef, }, routeConfig, - }; + }), [ + files, + setFiles, + uploadFiles, + uploadProgress, + state, + accept, + fileTypes, + mode, + multiple, + routeConfig, + ]); return (