Skip to content
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

No Progress on Server Actions #15

Open
maltesa opened this issue May 29, 2023 · 3 comments
Open

No Progress on Server Actions #15

maltesa opened this issue May 29, 2023 · 3 comments
Labels
enhancement New feature or request

Comments

@maltesa
Copy link

maltesa commented May 29, 2023

Thank you for this awesome library. I started using nextjs server actions.
Currently, the toploader does not appear when a server action is in progress. It would be awesome if that would work too.

Server.Actions.Loading.Indicator.1.mp4
@ekimcem
Copy link

ekimcem commented Oct 28, 2023

That would be perfect!

@lorikku
Copy link
Contributor

lorikku commented Dec 11, 2023

This is probably out of scope for this library. I think it's specifically made to support Nextjs' linking/navigation system, not for async operations such as server actions. You should handle user feedback when eg. submitting a form yourself.

You can however have more programatic control over the navigation itself (eg. after your server action is complete) using NProgress.

Edit: there's tons of "React topbar loader" libraries out there that are not tailored only to Nextjs' navigation, maybe you should check those out as well.

@TheSGJ TheSGJ added the enhancement New feature or request label Feb 2, 2024
@webdevcody
Copy link

webdevcody commented Jul 4, 2024

putting this here in case it helps anyone else. If you want to manually show the loader, install nprogress in your project and just do something like this. You can still call redirect inside your server action.

import * as NProgress from "nprogress";

onClick={async () => {
  NProgress.start();
  signOutAction().then(() => {
    NProgress.done();
  });
}}

a utility decorator function such as withTopLoader(signOutAction)(args) might be useful

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

5 participants