server action pending state without useFormStatus
Answered
Baldfaced hornet posted this in #help-forum
Baldfaced hornetOP
I found a solution with useTransition that seems to work at https://github.com/vercel/next.js/discussions/51371, however that hook docs say it should only wrap sync functions, so I wanted to ask if using it this way could cause any issues, or if there's other ways to do it.
action: https://github.com/Vsevolod-Shustov/holodex-nextjs/blob/main/app/lib/actions.ts
hook that use the action: https://github.com/Vsevolod-Shustov/holodex-nextjs/blob/main/app/hooks/useLiveData.ts
component that use the hook: https://github.com/Vsevolod-Shustov/holodex-nextjs/blob/main/app/components/VideoGrid.tsx
action: https://github.com/Vsevolod-Shustov/holodex-nextjs/blob/main/app/lib/actions.ts
hook that use the action: https://github.com/Vsevolod-Shustov/holodex-nextjs/blob/main/app/hooks/useLiveData.ts
component that use the hook: https://github.com/Vsevolod-Shustov/holodex-nextjs/blob/main/app/components/VideoGrid.tsx
3 Replies
react added support for async transitions a few months ago
Answer