Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting error "received invalid properties 'activeWhen'" with json routes #162

Open
jhaskett opened this issue Apr 22, 2022 · 0 comments
Open

Comments

@jhaskett
Copy link

using: Single Spa Layout 1.6.0

I'm creating our routes through json like so:

let baseRouteArray = [
      {
        type: 'nav',
        routes: [
          { type: 'application', name: 'name1', props: data.props },
        ],
      },
      {
        type: 'route',
        default: true,
        routes: [
          { type: 'application', name: 'name2', props: data.props },
        ],
      },
      {
        type: 'route',
        path: 'somepath',
        routes: [
          { type: 'application', name: 'name2', props: data.props },
        ],
      },
      {
        type: 'route',
        path: 'anotherpath',
        routes: [
          { type: 'application', name: 'name3', props: data.props },
        ],
      },
    ]

    routeArray.push(...baseRouteArray)
  }

  const routeJson = constructRoutes({
    mode: "history",
    base: "/",
    disableWarnings: true,
    routes: routeArray,
  })

When the routes are being created though the property activeWhen is being added to the routes as such (path names removed)

image

Because of this on the console for each route we get the following message:

Error: Invalid routesConfig.routes[1]: received invalid properties 'activeWhen', but valid properties are type, path, routes, props, default, exact
    at g (single-spa-layout.min.js:2:2303)
    at e (single-spa-layout.min.js:2:6301)
    at E (single-spa-layout.min.js:2:3133)

Haven't been able to get the error to go away with any settings I've made. We do not get this if we use HTML layouts, but we have some routes that are only available based on the users URL.

Any help would be appreciated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant