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

[1.0] Upgrade to React Router v4 #937

Closed
7 of 12 tasks
KyleAMathews opened this issue May 8, 2017 · 1 comment
Closed
7 of 12 tasks

[1.0] Upgrade to React Router v4 #937

KyleAMathews opened this issue May 8, 2017 · 1 comment

Comments

@KyleAMathews
Copy link
Contributor

KyleAMathews commented May 8, 2017

https://www.meetfabric.com/ is built on Gatsby 0.x. I'm helping them currently upgrade to Gatsby v1. As part of this work, they're integrating their app (currently a standalone React site) and their marketing website so they'll all be powered by Gatsby.

This is a pattern I'd really love to see more of since Gatsby v1's automatic code splitting makes this cheap to do. Land on a marketing page, login, and immediately jump into the app with no jarring reload. Use the same tools and components and styles across all your web properties!

But as they'd built their app using React Router v4, we decided it'd be best if Gatsby v1 got updated to RRv4 as well (currently we're still on RRv2).

I'll be working on this the next few days and it'll get rolled out as part of the next alpha.

Here's a rough list for the TODOs:

  • since RR v4 doesn't need statically defined routes, out routes info as a JSON object and dynamically construct routes in client.
  • restore 404 support
  • refactor code splits
    • all gatsby code in commons.js
    • all layout and page components have their own code splits
    • extract common code from layout components in addition to page.
  • server rendering of routes
  • Inline routes information in each HTML page. Defer loading full routes until after JS initialized.
  • use window.caches for caching linked pages https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/caches
  • reevaluate which JS bundles gatsby-plugin-offline precaches
  • let layouts have graphql queries
  • let layouts have parent layouts
@KyleAMathews
Copy link
Contributor Author

And it's merged! I didn't finish up all the work I'd liked to. Create an issue if you want to work on having multiple layouts, layouts with parents, layouts with graphql queries, or optimizing how we lazy-load page dependencies!

These all need to be done but aren't on the critical path to releasing Gatsby v1 and can be added afterwards without breaking changes (though of course if you want it now, please add a PR and we'll get it in with 1.0's release).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant