Next.js Discord

Discord Forum

Perform a server action without triggering a page reload ?

Answered
Southern African anchovy posted this in #help-forum
Open in Discord
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
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....
View full answer

10 Replies

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!