stereobooster / react-snap

👻 Zero-configuration framework-agnostic static prerendering for SPAs
MIT License
5.04k stars 391 forks source link

Showing wrong root route for every route for few seconds #422

Closed addamove closed 4 years ago

addamove commented 4 years ago

Bug Report

Current Behavior Just the latest CRA with few routes. When you upload it to Heroku it shows the root route for every route for a few seconds.

Config

    "reactSnap": {
        "cacheAjaxRequests": true,
        "inlineCss": true,
        "http2PushManifest": true,
        "puppeteerArgs": [
            "--no-sandbox",
            "--disable-setuid-sandbox"
        ]
    },
import {BrowserRouter as Router, Route, Switch} from 'react-router-dom';

const ComponentA = () => <div>A</div>;
const ComponentB = () => <div>B</div>;
const Root = () => <h1>ROOT</h1>;

const App = () => (
    <Router>
        <div>
            <Switch>
                <Route path='/' exact component={Root} />
                <Route path='/a' exact component={ComponentA} />
                <Route path='/b' exact component={ComponentB} />
            </Switch>
        </div>
    </Router>
);

export default App;

Reproducible demo Link to GitHub repository or codesandbox with a demo of the bug behavior.

https://coursebud-staging.herokuapp.com/a - temporary you can look at the issue here. You can easily see it if throttle network speed

Expected behavior/code Always show correct route during loading

Additional context/Screenshots For example, for https://coursebud-staging.herokuapp.com/a page it shows "ROOT" for a second which is not expected

addamove commented 4 years ago

Cannot keep demo live anymore