Skip to content

Route instance no longer accessible to getComponents in 2.2.0 #3305

@kpdecker

Description

@kpdecker

Version

2.2.0

Test Case

    <Route
        path={path}

        getComponent={function(location, callback) {
          loader((routes) => {
            this.scriptPath = routes.path.replace(/^.*\//, '');
            callback(undefined, routes.rootComponent);
          });
        }}
        getIndexRoute={function(location, callback) {
            this.scriptPath = routes.path.replace(/^.*\//, '');
            callback(undefined, routes.indexRoute);
        }}
    />

Steps to reproduce

Attempt to access route object through this in getComponent or getComponents.

Expected Behavior

The current route is available on the this object as was implemented in previous versions and is also implemented for helpers like getIndexRoute. Alternatively, this is explicitly exposed somewhere.

Actual Behavior

this is undefined.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions