Skip to content

App wrapper not rendered for sibling route #2910

@csvn

Description

@csvn

This was a bit fiddly to reproduce. But my issue is basically the following:

  • A route routes/bar.tsx has skipAppWrapper: true and skipInheritedLayouts: true
  • A route routes/foo.tsx has no config set
  • A route routes/index.tsx has no config set
  • There is a _app.tsx and _500.tsx in routes/
  • The path /foo is rendered without the _app.tsx wrapper

I came upon this bug when I has a route in my app inside routes/api/cart which was intended to return partials, and thus did not need _app or _layout. Instead though, this caused all routes except / to no longer get the app wrapper.

If I removed the config from _500.tsx, or removed the _500.tsx, I could no longer reproduce the issue. So I could not manage to make the reproduction any smaller than this.

PR with failing unit test

I managed to create a unit test that fails with the same issue in #2911.

Reproduction

The issue was a bit fiddly to reproduce, as it seems to depend on the order in which routes are read. /index.tsx is rendered correctly (has App wrapper), but the /foo.tsx route does not even though it should. I haven't found the solution to this, but it looks to me that whether an app-wrapper exists or not can be permanently set to false for a certain order of route handling.

// _500.tsx
export const config = {
  skipInheritedLayouts: true
};

export default () => {
  return <h2>500 error</h2>;
};
// _app.tsx
export default (({ Component }) => {
  return <>app/<Component /></>;
};
// bar.tsx
export const config = {
  skipAppWrapper: true,
  skipInheritedLayouts: true
};

export default () => {
  return <>bar</>;
};
// foo.tsx
export default () => {
  return <>foo</>;
};
// index.tsx
export default () => {
  return <>index</>;
};

Expected result

Route /foo has an app wrapper.

Actual result

Route /foo does not have ean app wrapper.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No fields configured for Bug.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions