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

Hydration fails with server actions enabled and custom tag in layout #51141

Closed
1 task done
mritzerfeld opened this issue Jun 11, 2023 · 7 comments
Closed
1 task done
Labels
bug Issue was opened via the bug report template. locked Upstream Related to using Next.js with a third-party dependency. (e.g., React, UI/icon libraries, etc.).

Comments

@mritzerfeld
Copy link

mritzerfeld commented Jun 11, 2023

Verify canary release

  • I verified that the issue exists in the latest Next.js canary release

Provide environment information

Operating System:
      Platform: darwin
      Arch: arm64
      Version: Darwin Kernel Version 22.5.0: Mon Apr 24 20:53:19 PDT 2023; root:xnu-8796.121.2~5/RELEASE_ARM64_T6020
    Binaries:
      Node: 20.2.0
      npm: 9.7.1
      Yarn: N/A
      pnpm: N/A
    Relevant packages:
      next: 13.4.5
      eslint-config-next: N/A
      react: 18.2.0
      react-dom: 18.2.0
      typescript: N/A

Which area(s) of Next.js are affected? (leave empty if unsure)

No response

Link to the code that reproduces this issue or a replay of the bug

http://github.com/mritzerfeld/next-server-action-with-custom-tag

To Reproduce

  1. Install latest next.js: npx create-next-app@latest
  2. Enable server actions in next.config.js
  3. Wrap {children} in root layout with custom HTML tag like <my-tag>

Describe the Bug

With server actions enabled in next.config.js, client-side hydration fails when a custom HTML tag with a dash like <my-tag> is present in a layout. The server response does not include any output for this tag and its children. Replacing the custom tag with a regular tag like <div> works completely fine.

Expected Behavior

Server-generated contents within custom HTML tags to be included in server response, as using Next without server actions or with regular HTML tags.

Which browser are you using? (if relevant)

No response

How are you deploying your application? (if relevant)

No response

@mritzerfeld mritzerfeld added the bug Issue was opened via the bug report template. label Jun 11, 2023
@Fredkiss3
Copy link
Contributor

Fredkiss3 commented Jun 12, 2023

I think it may be because server actions opt you into the experimental version of react and they may have done some work around custom elements that causes this error.

The default version of react that next uses is the canary version which the react team said that framework could use as they are close to a stable version.

@mritzerfeld
Copy link
Author

@Fredkiss3 That's a good point. Is there any way to use the experiment version of React in Next without enabling a specific unstable feature?

@shuding shuding added the Upstream Related to using Next.js with a third-party dependency. (e.g., React, UI/icon libraries, etc.). label Aug 25, 2023
@shuding
Copy link
Member

shuding commented Aug 25, 2023

Hey, could you open an issue to https://github.com/facebook/react? This is likely a problem of the experimental version of React.

@mritzerfeld
Copy link
Author

Done at facebook/react#27286

@mritzerfeld
Copy link
Author

Issue has been solved according to facebook/react#27286. So it should be working again in Next.js once the included canary build gets updated.

@mritzerfeld
Copy link
Author

Issue is resolved as of Next 14.0.0.

Copy link
Contributor

This closed issue has been automatically locked because it had no new activity for 2 weeks. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 11, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue was opened via the bug report template. locked Upstream Related to using Next.js with a third-party dependency. (e.g., React, UI/icon libraries, etc.).
Projects
None yet
Development

No branches or pull requests

3 participants