File tree Expand file tree Collapse file tree
packages/gatsby/cache-dir Expand file tree Collapse file tree Original file line number Diff line number Diff line change 44 "version" : " 1.0.0" ,
55 "author" : " Jason Lengstorf <jason@lengstorf.com>" ,
66 "dependencies" : {
7- "gatsby" : " next " ,
7+ "gatsby" : " ^2.0.0-beta.91 " ,
88 "gatsby-plugin-react-helmet" : " next" ,
99 "prop-types" : " ^15.6.1" ,
1010 "react" : " ^16.4.0" ,
Original file line number Diff line number Diff line change 11import React from "react"
22import PropTypes from "prop-types"
3- import { Router , navigate } from "@reach/router"
3+ import { navigate } from "@reach/router"
44import { isLoggedIn } from "../utils/auth"
55
6- const PrivateRoute = ( { component : Component , ...rest } ) => {
7- if ( ! isLoggedIn ( ) && window . location . pathname !== `/app/login` ) {
6+ const PrivateRoute = ( { component : Component , location , ...rest } ) => {
7+ if ( ! isLoggedIn ( ) && location . pathname !== `/app/login` ) {
88 // If we’re not logged in, redirect to the home page.
99 navigate ( `/app/login` )
1010 return null
1111 }
1212
13- return (
14- < Router >
15- < Component { ...rest } />
16- </ Router >
17- )
13+ return < Component { ...rest } />
1814}
1915
2016PrivateRoute . propTypes = {
Original file line number Diff line number Diff line change @@ -10,9 +10,9 @@ import Status from "../components/Status"
1010const App = ( ) => (
1111 < Layout >
1212 < Status />
13- < PrivateRoute path = "/app/profile" component = { Home } />
14- < PrivateRoute path = "/app/details" component = { Details } />
1513 < Router >
14+ < PrivateRoute path = "/app/profile" component = { Home } />
15+ < PrivateRoute path = "/app/details" component = { Details } />
1616 < Login path = "/app/login" />
1717 </ Router >
1818 </ Layout >
Original file line number Diff line number Diff line change @@ -305,7 +305,10 @@ const queue = {
305305 }
306306 } ,
307307
308- getResourcesForPathnameSync : path => pathScriptsCache [ path ] ,
308+ getResourcesForPathnameSync : path => {
309+ const page = findPage ( path )
310+ return pathScriptsCache [ page . path ]
311+ } ,
309312
310313 getResourcesForPathname : path => {
311314 queue . checkIfDoingInitialRenderForSW ( path )
@@ -363,6 +366,7 @@ const queue = {
363366 component : syncRequires . components [ page . componentChunkName ] ,
364367 page,
365368 }
369+
366370 // Add to the cache.
367371 pathScriptsCache [ path ] = pageResources
368372 devGetPageData ( page . path ) . then ( pageData => {
You can’t perform that action at this time.
0 commit comments