Skip to content

Handle redirects causing navigations instead of pageloads #14492

@AbhiPrasad

Description

@AbhiPrasad

Description

For a setup like the following:

const router = sentryCreateHashRouter(
  [
    {
      path: '/',
      element: (
        <Layout/>
      ),
      children: [
        { index: true, element: <BaseRouteRedirect /> },
        { path: '/a', element: <PageA /> },
        { path: '/b/view', element: <PageB /> },
        { path: '*', element: <NoMatch /> },
      ],
    },
  ]
);

When the index route, / is hit, a redirect happens to either page a or page b. This is effectively a redirect guard.

As a consequence, there is no pageloads, instead only navigations, which means that web vital values are not properly calculated for these routes.

We need to figure out a way to make sure that the SDK is aware of this pattern. Essentially redirects should be treated as part of the pageload, with just the name being updated. This needs the code to be handled a little differently.

Relevant slack thread internally: https://sentry.slack.com/archives/C4E31MGD8/p1731320946423889

┆Issue is synchronized with this Jira Improvement by Unito

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions