Intermittent dynamic route error
See original GitHub issueAre you reporting a bug?
Yes
I have a single non-static /admin
route.
Like this commenter on Spectrum describes, I’m seeing an error (sometimes) when loading the admin route:
Uncaught (in promise) TypeError: Cannot set property 'templateLoaded' of undefined
I can navigate successfully on client, and load page from server. Every so often upon a reload of the app, then navigating to /admin
I see that error.
The Spectrum comment is addressing something else with more complex dynamic routes. But mine is a single route, as per the non-static route example, showing the same error.
Caching bug? Race condition?
Location of error:
Environment
react-static -v
:5.9.7
node -v
:v9.11.1
yarn --version or npm -v
:npm: 6.1.0
- Operating system:
macOS Sierra 10.12.6
- Browser and version (if relevant):
Chrome 69.0.3472.3
Steps to Reproduce the problem
Base your steps off of any freshly installed react-static template!
- Load app, any route (/admin should work)
- Navigate around, works
- Reload app… sometimes client navigation to /admin produces error above.
static.config.js
getRoutes: async () => {
const value = await admin
.database()
.ref('health')
.once('value')
.then(snap => snap.val())
// const snap = await snapPromise
console.log({ value })
const membersLoad = loadEntity('members')
const eventsLoad = loadEntity('events')
const linksLoad = loadEntity('links')
const [members, events, links] = await Promise.all([
membersLoad,
eventsLoad,
linksLoad,
])
return [
{
path: '/',
component: 'src/containers/Events',
getData: () => ({ events }),
},
{
path: '/members',
component: 'src/containers/Members',
getData: () => ({ members }),
},
{
path: '/links',
component: 'src/containers/Links',
getData: () => ({ links }),
},
{
is404: true,
component: 'src/containers/404',
},
]
},
App.js
const Admin = universal(() => import('../containers/Admin'))
const App = () => (
<Router>
<div id="app">
<Header />
<div id="content">
<Switch>
<Route path="/admin" component={Admin} />
<Routes />
</Switch>
</div>
</div>
</Router>
)
Admin.js
import React from 'react'
import { AuthConsumer, AuthProvider } from '../components/Auth'
class Admin extends React.Component {
render() {
return (
<div
css={`
margin-top: 2em;
`}
>
<AuthProvider>
<AuthConsumer>
{({ user, signOut }) => {
return (
<div>
<ul>
<li>{user.email}</li>
<li>{user.displayName}</li>
</ul>
<pre>{JSON.stringify({ user }, null, 2)}</pre>
<button onClick={signOut}>Sign Out</button>
</div>
)
}}
</AuthConsumer>
</AuthProvider>
</div>
)
}
}
export default Admin
Expected Behavior
Always works, error never shows.
Issue Analytics
- State:
- Created 5 years ago
- Comments:5 (4 by maintainers)
Top Results From Across the Web
Intermittent dynamic route error #649 - react-static ... - GitHub
I can navigate successfully on client, and load page from server. Every so often upon a reload of the app, then navigating to...
Read more >Intermittent error when running Dynamic Cube reports - IBM
Package routing is enabled and configured correctly to only route requests for that dynamic cube package to servers which have the cube running....
Read more >How to Troubleshoot Routing Problems - Auvik Networks
Fast and effective ways to troubleshoot internet routing issues from network expert and author Kevin Dooley.
Read more >What Causes Route Flapping? - Geek Speak - Resources
... Intermittent errors in communications links; Unreliable connections. Route flapping is a common condition in the network when dynamic adaptive routing ...
Read more >Bug #1837379 “Intermittent deployment failures with unit in ...
OpenStack Neutron Dynamic Routing charm 19.07 ... 2019-07-22 09:12:05.912 16088 ERROR neutron File "/usr/bin/neutron-bgp-dragent", line 10, ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Any updates on how to handle this? I have this issue in v6.
This issue has been automatically marked as stale because it has not had recent activity in 7 days. It will be closed if no further activity occurs. Thank you for your contributions.