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

Error: [Bug] No render context found (v0.20.0-alpha.0) #586

Closed
t6adev opened this issue Mar 9, 2024 · 1 comment · Fixed by #587
Closed

Error: [Bug] No render context found (v0.20.0-alpha.0) #586

t6adev opened this issue Mar 9, 2024 · 1 comment · Fixed by #587

Comments

@t6adev
Copy link
Contributor

t6adev commented Mar 9, 2024

I am getting errors using server actions.
The error occurs when a server action function has await code.

'use server';

import { rerender } from 'waku/server';

const sleep = (ms: number) => new Promise((resolve) => setTimeout(resolve, ms));

export const actionWithFormData = async (formData: FormData) => {
  await sleep(0); // Getting error with await
  const title = formData.get('title');
  if (title === null) {
    throw new Error('Unexpected null title');
  }
  console.log(title);
  rerender('/');
};

export const actionWithoutFormData = async (title: string) => {
  await sleep(0); // Getting error with await
  console.log(title);
  rerender('/');
};

If you remove the await line, no errors will happen.

version: 0.20.0-alpha.0
repro: https://github.com/t6adev/waku-form-action-sample

@dai-shi
Copy link
Owner

dai-shi commented Mar 9, 2024

Thanks for reporting! 🤔

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

Successfully merging a pull request may close this issue.

2 participants