fix(ui): persist folder upload input across page refresh#551
Open
MunemHashmi wants to merge 1 commit intoopenclaw:mainfrom
Open
fix(ui): persist folder upload input across page refresh#551MunemHashmi wants to merge 1 commit intoopenclaw:mainfrom
MunemHashmi wants to merge 1 commit intoopenclaw:mainfrom
Conversation
…penclaw#58) Replace the useEffect + useRef approach for setting webkitdirectory/ directory attributes with a ref callback that sets the attributes every time the input element is mounted. This ensures folder selection mode persists after page refresh, where React hydration could strip the non-standard attributes. Also removes the @ts-expect-error JSX props since the attributes are now set imperatively via the ref callback.
Contributor
|
@MunemHashmi is attempting to deploy a commit to the Amantus Machina Team on Vercel. A member of the Team first needs to authorize it. |
Contributor
Greptile SummaryFixes folder upload input losing
Confidence Score: 5/5
Last reviewed commit: 55100fc |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #58
After a page refresh on
/upload, the file input lost itswebkitdirectoryattribute and switched from folder selection mode to individual file mode. This made it impossible to upload multi-file skills via the browser after refreshing.Root cause
The
webkitdirectoryanddirectoryattributes were set via:@ts-expect-error) — React may strip these during hydrationuseEffect([], ...)fallback — doesn't re-fire when React hydrates (rather than fresh-mounts) the component after a page refreshFix
Replaced both approaches with a ref callback that imperatively sets
webkitdirectoryanddirectoryevery time the input element is attached to the DOM. This is reliable across initial render, hydration, and re-renders.Test plan
bun run test -- src/__tests__/upload.route.test.tsx— 8/8 pass (existing testmarks the input for folder uploadsstill passes)bun run lint— 0 warnings, 0 errors