question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Opted out of Automatic Prerendering

See original GitHub issue

Bug report

Describe the bug

All of my pages are forced to be SSR due to getInitialProps in pages/_app.

Though both my _document and _app don’t have any getInitialProps

Expected behavior

To have pages without getInitialProps as prerendered static HTML

System information

  • Version of Next.js: [e.g. 9.0.1]

Additional context

Here is my package.json if it helps

  "dependencies": {
    "@fortawesome/fontawesome-svg-core": "^1.2.19",
    "@fortawesome/free-regular-svg-icons": "^5.9.0",
    "@fortawesome/free-solid-svg-icons": "^5.9.0",
    "@fortawesome/react-fontawesome": "^0.1.4",
    "@zeit/next-css": "^1.0.1",
    "axios": "^0.19.0",
    "chart.js": "^2.8.0",
    "compression": "^1.7.4",
    "cross-env": "^5.2.0",
    "detect-node": "^2.0.4",
    "express": "^4.17.1",
    "locize-cli": "^4.8.0",
    "next": "^9.0.1",
    "next-i18next": "^0.45.0",
    "node-java-maven": "^0.1.1",
    "react": "^16.8.6",
    "react-chartjs-2": "^2.7.6",
    "react-dom": "^16.8.6",
    "react-select": "^3.0.4",
    "react-table": "^6.10.0",
    "styled-components": "^4.3.2"
  },
  "devDependencies": {
    "@types/chart.js": "^2.7.55",
    "@types/enzyme": "^3.10.2",
    "@types/enzyme-adapter-react-16": "^1.0.5",
    "@types/jest": "^24.0.15",
    "@types/next": "^8.0.6",
    "@types/node": "^12.6.2",
    "@types/react": "^16.8.23",
    "@types/react-dom": "^16.8.4",
    "@types/react-select": "^3.0.0",
    "@types/react-table": "^6.8.4",
    "@types/styled-components": "^4.1.18",
    "babel-core": "^6.26.3",
    "babel-jest": "^24.8.0",
    "babel-plugin-styled-components": "^1.10.6",
    "babel-preset-env": "^1.7.0",
    "babel-preset-react": "^6.24.1",
    "enzyme": "^3.10.0",
    "enzyme-adapter-react-16": "^1.14.0",
    "enzyme-to-json": "^3.3.5",
    "husky": "^3.0.0",
    "jest": "^24.8.0",
    "jest-styled-components": "^6.3.3",
    "nodemon": "^1.19.1",
    "prettier": "^1.18.2",
    "pretty-quick": "^1.11.1",
    "ts-jest": "^24.0.2",
    "ts-node": "^8.3.0",
    "tslint": "^5.18.0",
    "tslint-config-prettier": "^1.18.0",
    "tslint-eslint-rules": "^5.4.0",
    "tslint-react": "^4.0.0",
    "typescript": "^3.5.3"
  },

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
timneutkenscommented, Jul 17, 2019

Just going to leave this answer here: https://github.com/FormidableLabs/urql/issues/344#issuecomment-512227740

Is there a better pattern to follow?

One way would be wrapping pages in the HoC like said on the other issue. Another would be to wait on the new things we’re working on. The name of this feature is quite clear, it’s an optimization so there’s no difference with what you did before if you don’t use it.

I’m going to close this issue as there’s nothing actionable from our side right now.

1reaction
GLObus303commented, Jul 13, 2019

Hi, can you post a link to a repo with this or your _app? It’s most likely do to a HOC that adds getInitialProps if you aren’t explicitly adding one yourself

You are right! Thank you!

Now there is a question. Is there a way to have statically render HTML pages with next-i18next (which was causing the issue)?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Add configuration to opt out of automatic prerendering #8014
The ability to opt out of pre-rendering is a huge need. Pre-rendering cost based resources (i.e., a page loading MapBox for example -...
Read more >
next export gives me an "Error occurred prerendering page"
I know it's an usual error, but I can't find any problems in my code. When I hit next build in my project,...
Read more >
Advanced Features: Automatic Static Optimization
Automatic Static Optimization. Next.js automatically determines that a page is static (can be prerendered) if it has no blocking data requirements.
Read more >
Prerender pages in Chrome for instant page navigations
The Chrome team has been working on options to bring back full prerendering of future pages that a user is likely to navigate...
Read more >
Prerendering does not have any distinguishing HTTP ...
No HTTP header is sent, and prerender requests are identical to navigation ... So in that sense, there already is a way to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found