Perform a server action without triggering a page reload ?
Answered
Southern African anchovy posted this in #help-forum
Southern African anchovyOP
Hello,
In a typical form, I've a special "treatment" to upload my images.
Because I want to upload them on a S3 service then show the preview
So, outside of the "submit" action of my form, I have a server action that uploads my images successfully...but when I get the response of my server action, I can see a full page reload (with the default spinner showing)...
Is this intended behavior or I might do something wrong ?
Thanks
In a typical form, I've a special "treatment" to upload my images.
Because I want to upload them on a S3 service then show the preview
So, outside of the "submit" action of my form, I have a server action that uploads my images successfully...but when I get the response of my server action, I can see a full page reload (with the default spinner showing)...
Is this intended behavior or I might do something wrong ?
Thanks
Answered by Southern African anchovy
@riský Yeah I'm just dumb. In the component I created to display my previews, it was a server component originally and I forgot to remove the async from the component declaration....
10 Replies
as i feel like your form just has the default action of reloading page with post req with formdata
Southern African anchovyOP
I think I can opt out this upload part from my main form and that would do the job, maybe
Southern African anchovyOP
@riský Yeah I'm just dumb. In the component I created to display my previews, it was a server component originally and I forgot to remove the async from the component declaration....
Answer
oh thats intresting
so you solved your issue!
Southern African anchovyOP
Yeah!
Thanks for helping ðŸ‘
sometimes the best way to fix your issue is just trying to explain to someone else lol
glad to help you!