Skip to content

create-next-app example to demo mutation bug for next-seo package

Notifications You must be signed in to change notification settings

TheBit/do-not-mutate-things

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This is a Next.js project bootstrapped with create-next-app.

What is this about?

This repo is just to demonstrate mutation bug for https://github.com/garmeeh/next-seo package.

garmeeh/next-seo#1313

It is even not using next-seo but mimics its code on pure Next.js.

Steps to reproduce

  1. pnpm install
  2. pnpm dev
  3. see the server console and page rendered in the browser
  4. now change src/pages/api/toggle.json to true and refresh the page
  5. see everything again - it is still fine, but you will notice a corresponding change
  6. now return the toggle to false and refresh the page
  7. you will now see a hydration error saying: Server: "{"noindex":true,"nofollow":false,"nosuchprop":"this prop will now persist between calls to page SSR (until the server restarts)"}" Client: "{"noindex":false,"nofollow":false}"
  8. you can use suppressHydrationWarning on h2 (or uncomment similar commented tag) to suppress the warning, but by now you should probably understand the problem - there should not be any hydration warnings and the server should have returned object with noindex: false as well as without nosuchprop)
  9. DO NOT MUTATE THINGS

Below goes regular Next.js README stuff:

Getting Started

First, run the development server:

npm run dev
# or
yarn dev
# or
pnpm dev
# or
bun dev

Open http://localhost:3000 with your browser to see the result.

You can start editing the page by modifying pages/index.js. The page auto-updates as you edit the file.

API routes can be accessed on http://localhost:3000/api/hello. This endpoint can be edited in pages/api/hello.js.

The pages/api directory is mapped to /api/*. Files in this directory are treated as API routes instead of React pages.

This project uses next/font to automatically optimize and load Inter, a custom Google Font.

Learn More

To learn more about Next.js, take a look at the following resources:

You can check out the Next.js GitHub repository - your feedback and contributions are welcome!

Deploy on Vercel

The easiest way to deploy your Next.js app is to use the Vercel Platform from the creators of Next.js.

Check out our Next.js deployment documentation for more details.

About

create-next-app example to demo mutation bug for next-seo package

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published