Gatsby: Not able to render page upon redirect

Created on 5 Oct 2018  路  10Comments  路  Source: gatsbyjs/gatsby

When the user is not logged in , the home page should be redirected to Login page. In the nav bar , i can clearly see that the url is http://localhost:3000/login but the login page is not rendered.

I have no issue with the same code in development environment. The issue is happening only when i try to run as a production build using gatsby serve command.

Is there any known issue with Gatsby navigate command? Kindly, please let me know if this is a known issue and any known workaround for the same.

Expected result
Url in nav bar updates and the page is shown

Actual result
blank page is shown until refresh occurs

System:
OS: macOS 10.14
CPU: x64 Intel(R) Core(TM) i7-4870HQ CPU @ 2.50GHz
Shell: 3.2.57 - /bin/bash
Binaries:
Node: 10.10.0 - /usr/local/bin/node
npm: 6.4.1 - /usr/local/bin/npm
Browsers:
Chrome: 69.0.3497.100
Firefox: 62.0.3
Safari: 12.0
npmPackages:
gatsby: ^2.0.0 => 2.0.2
gatsby-plugin-create-client-paths: ^2.0.0 => 2.0.0
gatsby-plugin-eslint: ^2.0.1 => 2.0.1
gatsby-plugin-manifest: ^2.0.2 => 2.0.2
gatsby-plugin-offline: ^2.0.5 => 2.0.5
gatsby-plugin-page-creator: ^2.0.0 => 2.0.0
gatsby-plugin-react-helmet: ^3.0.0 => 3.0.0
npmGlobalPackages:
gatsby-cli: 2.4.1

stale?

Most helpful comment

I have found a workaround
image

All 10 comments

Can you build a site that reproduces this issue?

Hello Kyle , Thanks for your attention. Please find the attached code that reproduces the issue.
navigate_issue_Aravind.zip

Kyle , did you get a chance to look in to this issue.

Thanks
Aravind

No not yet. @kakadiadarpan can you validate @bluefig99's reproduction?

@KyleAMathews I'm able to reproduce the issue reported by @bluefig99. When you load the build for the first time, you get a blank page. When you load it again, we get to see the login screen as expected.

The first load fails to load the redirected screen, the second load is successful.

I got the same error. Here the code of my IndexPage

import React from 'react'
import { Redirect } from '@reach/router'

const IndexPage = props => (
  <Redirect to='driver-deposit' />
)

export default IndexPage

This is what I get after redirect happened

image

@KyleAMathews can you please check whether this is an issue here?

I have found a workaround
image

Old issues will be closed after 30 days of inactivity. This issue has been quiet for 20 days and is being marked as stale. Reply here or add the label "not stale" to keep this issue open!

Hey again!

It鈥檚 been 30 days since anything happened on this issue, so our friendly neighborhood robot (that鈥檚 me!) is going to close it.

Please keep in mind that I鈥檓 only a robot, so if I鈥檝e closed this issue in error, I鈥檓 HUMAN_EMOTION_SORRY. Please feel free to reopen this issue or create a new one if you need anything else.

Thanks again for being part of the Gatsby community!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

dustinhorton picture dustinhorton  路  3Comments

jimfilippou picture jimfilippou  路  3Comments

ghost picture ghost  路  3Comments

timbrandin picture timbrandin  路  3Comments

theduke picture theduke  路  3Comments