-
Notifications
You must be signed in to change notification settings - Fork 4
fix: pass useUpload hook at F0Form level instead of field-level #3752
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -166,8 +166,6 @@ export interface F0FileConfig { | |||||||||||||||||||||
| multiple?: boolean | ||||||||||||||||||||||
| /** Helper text shown in the dropzone area */ | ||||||||||||||||||||||
| description?: string | ||||||||||||||||||||||
| /** Consumer-provided hook that returns upload capabilities */ | ||||||||||||||||||||||
| useUpload: UseFileUpload | ||||||||||||||||||||||
| } | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| /** | ||||||||||||||||||||||
|
|
@@ -183,8 +181,6 @@ export type F0FileField = F0BaseField & { | |||||||||||||||||||||
| multiple?: boolean | ||||||||||||||||||||||
| /** Dropzone description text */ | ||||||||||||||||||||||
| description?: string | ||||||||||||||||||||||
|
||||||||||||||||||||||
| description?: string | |
| description?: string | |
| /** | |
| * Consumer-provided upload hook. | |
| * | |
| * This is primarily used for standalone file fields rendered outside of | |
| * `<F0Form>` / `F0FormContext.Provider`, where the upload hook cannot be | |
| * supplied via context. | |
| */ | |
| useUpload?: UseFileUpload |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
File uploads are now sourced from
context?.useUpload, but whenuseUploadisn't provided the UI still lets users pick/drop files and then uploads never start (becauseFileUploadItemno-ops without an upload hook). Please add an explicit guard (e.g. hide/disable the dropzone when nouseUploadis configured, or surface a clear error/throw when a new file is added) so misconfiguration doesn't fail silently.