{"action":"created","issue":{"url":"https://api.github.com/repos/nuxt/nuxt.js/issues/2690","repository_url":"https://api.github.com/repos/nuxt/nuxt.js","labels_url":"https://api.github.com/repos/nuxt/nuxt.js/issues/2690/labels{/name}","comments_url":"https://api.github.com/repos/nuxt/nuxt.js/issues/2690/comments","events_url":"https://api.github.com/repos/nuxt/nuxt.js/issues/2690/events","html_url":"https://github.com/nuxt/nuxt.js/issues/2690","id":291719667,"node_id":"MDU6SXNzdWUyOTE3MTk2Njc=","number":2690,"title":"Proposal: Allow fallback to SPA in universal mode's generate","user":{"login":"jeroenvisser101","id":1941348,"node_id":"MDQ6VXNlcjE5NDEzNDg=","avatar_url":"https://avatars1.githubusercontent.com/u/1941348?v=4","gravatar_id":"","url":"https://api.github.com/users/jeroenvisser101","html_url":"https://github.com/jeroenvisser101","followers_url":"https://api.github.com/users/jeroenvisser101/followers","following_url":"https://api.github.com/users/jeroenvisser101/following{/other_user}","gists_url":"https://api.github.com/users/jeroenvisser101/gists{/gist_id}","starred_url":"https://api.github.com/users/jeroenvisser101/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jeroenvisser101/subscriptions","organizations_url":"https://api.github.com/users/jeroenvisser101/orgs","repos_url":"https://api.github.com/users/jeroenvisser101/repos","events_url":"https://api.github.com/users/jeroenvisser101/events{/privacy}","received_events_url":"https://api.github.com/users/jeroenvisser101/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":25,"created_at":"2018-01-25T21:21:06Z","updated_at":"2018-11-03T20:58:30Z","closed_at":"2018-01-30T14:24:10Z","author_association":"CONTRIBUTOR","body":"## Intro\r\nWe're using Nuxt.js to build a site. We have an GraphQL API that we query to get all the content. Nuxt.js is then used to generate a 'prerendered' version of the site, that will be interactive once fully loaded. Consecutive page loads (user navigating around the site) only load GraphQL data (and if needed, additional JS).\r\n\r\n## Problem\r\nNow, we were anticipating that the 'universal' mode would allow us to generate routes for all dynamic pages, but when someone adds new data, some problems arise.\r\n\r\nImagine the following on the [`async-data` example](https://nuxtjs.org/examples/async-data) when being served on a static hosting (e.g. Netlify, Firebase Hosting) being built by running `nuxt generate`:\r\n1. **User navigates to home page**<br>We serve the generated `index.html` through Firebase Hosting, the page will become interactive but no additional queries are performed on the client side.\r\n2. **User clicks on Blog**<br>We query the posts and show all post titles with a link to their respective routes.\r\n3. **User clicks on a post that hasn't been generated ([`/posts/1` is generated, but all the others are not](https://github.com/nuxt/nuxt.js/blob/dev/examples/async-data/nuxt.config.js#L15) and exists only in the database**<br>We query the post by id, and we render the component.\r\n4. **For some reason (refresh, user copies URL and shares it, etc.) the page is loaded from scratch**<br>Now, there are two ways this could go:\r\n    1. Firebase responds with a 404 status (because the prerendered file could not be found)\r\n    2. We could serve the `index.html`, but since it assumes that it was correctly generated, upon becoming interactive, it won't notice the route doesn't match the rendered content, and shows the wrong content (the homepage).\r\n\r\n## Proposal\r\nSo to solve this issue and to make Nuxt.js more flexible when used in 'universal' mode but deployed statically, I'd want to suggest a configuration option where—aside from the generated pages—a HTML file with the SPA template (with the loader and without any data) would be returned which would allow us to route all 'Not found' traffic to the SPA template.\r\n\r\nThis would allow us to build a platform where data changes trigger rebuilds of the site (e.g. run `nuxt generate` asynchronously) but where the route would function instantly.\r\n\r\nI'd love to get your thoughts on this, to see if you have a better suggestion on handling cases like these. Thanks!\n\n<!--cmty--><!--cmty_prevent_hook-->\n<div align=\"right\"><sub><em>This question is available on <a href=\"https://nuxtjs.cmty.io\">Nuxt.js</a> community (<a href=\"https://nuxtjs.cmty.io/nuxt/nuxt.js/issues/c2338\">#c2338</a>)</em></sub></div>"},"comment":{"url":"https://api.github.com/repos/nuxt/nuxt.js/issues/comments/435620397","html_url":"https://github.com/nuxt/nuxt.js/issues/2690#issuecomment-435620397","issue_url":"https://api.github.com/repos/nuxt/nuxt.js/issues/2690","id":435620397,"node_id":"MDEyOklzc3VlQ29tbWVudDQzNTYyMDM5Nw==","user":{"login":"lock[bot]","id":33595554,"node_id":"MDM6Qm90MzM1OTU1NTQ=","avatar_url":"https://avatars1.githubusercontent.com/in/6672?v=4","gravatar_id":"","url":"https://api.github.com/users/lock%5Bbot%5D","html_url":"https://github.com/apps/lock","followers_url":"https://api.github.com/users/lock%5Bbot%5D/followers","following_url":"https://api.github.com/users/lock%5Bbot%5D/following{/other_user}","gists_url":"https://api.github.com/users/lock%5Bbot%5D/gists{/gist_id}","starred_url":"https://api.github.com/users/lock%5Bbot%5D/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lock%5Bbot%5D/subscriptions","organizations_url":"https://api.github.com/users/lock%5Bbot%5D/orgs","repos_url":"https://api.github.com/users/lock%5Bbot%5D/repos","events_url":"https://api.github.com/users/lock%5Bbot%5D/events{/privacy}","received_events_url":"https://api.github.com/users/lock%5Bbot%5D/received_events","type":"Bot","site_admin":false},"created_at":"2018-11-03T20:58:30Z","updated_at":"2018-11-03T20:58:30Z","author_association":"NONE","body":"This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.\n"}}
{"actor":{"display_login":"lock"}}