fix: use event parameter in CardAdd image selection handler
All checks were successful
CI / update (push) Successful in 1m21s
All checks were successful
CI / update (push) Successful in 1m21s
The show_local_image function was using `this.files[0]` which doesn't work in Svelte 5's onchange handlers. Changed to use `event.target.files[0]` to properly access the selected file. This fixes recipe image uploads not working because the file was never being captured from the input element.
This commit is contained in:
@@ -58,8 +58,9 @@ let upload_error = $state("");
|
||||
* Handles image file selection and preview
|
||||
* The actual upload will happen when the form is submitted
|
||||
*/
|
||||
export async function show_local_image(){
|
||||
const file = this.files[0];
|
||||
export async function show_local_image(event: Event){
|
||||
const input = event.target as HTMLInputElement;
|
||||
const file = input.files?.[0];
|
||||
if (!file) {
|
||||
console.log('[CardAdd] No file selected');
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user