found: Unhandled promise rejection on redirect

https://github.com/4Catalyzer/found#redirects

We successfully use redirects elsewhere in our app, but are encountering a problem with our dashboard redirect - for some reason I can’t spot. I’ve searched and cannot find a related issue.

Here is a snippet of code from the route:

      <Route
        path="/"
        Component={loadable(() => import(/* webpackChunkName: "Landing" */ './LandingPage'))}
        render={args => {
          const { Component, props } = args
          const subdomain = resolveSubdomain()
          if (subdomain) {
            throw new RedirectException('/dashboard')
          } else {
            return !Component ? undefined : <Component {...props} />
          }
        }}
      />

The results of this are:

Unhandled promise rejection 
Object { location: "/dashboard" }
es6.promise.js:110
onUnhandled/</result<
es6.promise.js:110
kiCJ/module.exports
_perform.js:3:12
onUnhandled/<
es6.promise.js:104
[6725]/module.exports
_invoke.js:5
<anonymous>
_task.js:35
run
_task.js:21
listener
_task.js:25

For context, this route is rendered within the following:

const RootRouteComponent = (props: AppFrameProps) => (
  <TenantSwitcher>
    <GoogleAnalyticsProvider>
      <AppFrame {...props} />
    </GoogleAnalyticsProvider>
  </TenantSwitcher>
)


      <Route>
        <Route Component={RootRouteComponent}>
          {this.resolve(LandingRoutes)} {/* Landing routes resolves to the code above */}
          {/* We do something similar here in renderAuthenticate and it works fine */}
          <Route render={this.renderAuthenticate}>
            {this.resolve(AccessRoutes)}
          </Route>
        </Route>
      </Route>

The routes guarded by <Route render={this.renderAuthenticate}> serve conditional redirects fine, the only thing different is that the redirect logic is on a parent route, whereas in the dashboard redirect, it is on the route with the component itself.

What am I missing here?

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 15 (14 by maintainers)

Most upvoted comments

I don’t really know what’s going on here. A couple of possibilities: