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

[Bug]: prerender causes page to be duplicated/rendered twice in RW projects using React18 #7757

Closed
1 task done
Tobbe opened this issue Mar 5, 2023 · 0 comments · Fixed by #7760
Closed
1 task done
Assignees
Labels
bug/needs-info More information is needed for reproduction

Comments

@Tobbe
Copy link
Member

Tobbe commented Mar 5, 2023

What's not working?

If you enable prerendering on a page it'll get rendered twice
image

image

How do we reproduce the bug?

yarn create redwood-app --ts --git rw-react18-prerender
cd rw-react18-prerender
yarn rw upgrade -t canary
yarn rw g page home /

Enable prerendering of Home

diff --git a/web/src/Routes.tsx b/web/src/Routes.tsx
index 2c8f02a..e398080 100644
--- a/web/src/Routes.tsx
+++ b/web/src/Routes.tsx
@@ -12,6 +12,7 @@ import { Router, Route } from '@redwoodjs/router'
 const Routes = () => {
   return (
     <Router>
+      <Route path="/" page={HomePage} name="home" prerender />
       <Route notfound page={NotFoundPage} />
     </Router>
   )
yarn rw build
yarn rw serve

Go to http://localhost:8910 and you'll see the page rendered twice.
(If you turn off javascript it'll only be rendered once)

What's your environment? (If it applies)

No response

Are you interested in working on this?

  • I'm interested in working on this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug/needs-info More information is needed for reproduction
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant