Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.
Python agentagentic-aiagentic-frameworkagentic-workflowaiautomationclaudedeepseekgenaigptllmlow-codemcpnextjsno-codeopenaipythonskillsworkflow
Revert "fix: sync FileUploader context with props to fix inconsistent file parameter state in “View cached variables”." (#26548)
crazywoola787251f00eb2
diff --git a/web/app/components/base/file-uploader/store.tsx b/web/app/components/base/file-uploader/store.tsxindex 7f7cfd5693e..cddfdf6f27b 100644--- a/web/app/components/base/file-uploader/store.tsx+++ b/web/app/components/base/file-uploader/store.tsx@@ -1,7 +1,6 @@import {createContext,useContext,- useEffect,useRef,} from 'react'import {@@ -19,11 +18,13 @@ type Shape = {export const createFileStore = (value: FileEntity[] = [],+ onChange?: (files: FileEntity[]) => void,) => {return create<Shape>(set => ({files: value ? [...value] : [],setFiles: (files) => {set({ files })+ onChange?.(files)},}))}@@ -54,35 +55,9 @@ export const FileContextProvider = ({onChange,}: FileProviderProps) => {const storeRef = useRef<FileStore | undefined>(undefined)- const onChangeRef = useRef<FileProviderProps['onChange']>(onChange)- const isSyncingRef = useRef(false)if (!storeRef.current)- storeRef.current = createFileStore(value)-- // keep latest onChange- useEffect(() => {- onChangeRef.current = onChange- }, [onChange])-- // subscribe to store changes and call latest onChange- useEffect(() => {- const store = storeRef.current!- const unsubscribe = store.subscribe((state: Shape) => {- if (isSyncingRef.current) return- onChangeRef.current?.(state.files)- })- return unsubscribe- }, [])-- // sync external value into internal store when value changes- useEffect(() => {- const store = storeRef.current!- const nextFiles = value ? [...value] : []- isSyncingRef.current = true- store.setState({ files: nextFiles })- isSyncingRef.current = false- }, [value])+ storeRef.current = createFileStore(value, onChange)return (<FileContext.Provider value={storeRef.current}>