rollbar-react icon indicating copy to clipboard operation
rollbar-react copied to clipboard

<RollbarContext /> implementation doesn't match docs

Open daniellzl opened this issue 2 years ago • 4 comments

Docs: https://docs.rollbar.com/docs/react#rollbarcontext-component

1 - RollbarContext requires the onRender prop

Calling

<RollbarContext context="home">…</RollbarContext>

doesn't actually set Rollbar's context to 'home'. On further examination of the RollbarContext component, I saw I needed to add a onRender prop for it to work:

<RollbarContext context="home" onRender>…</RollbarContext>

This doesn't align with the docs linked above.

2 - RollbarContext type is incorrect

Given the requirement of the onRender prop, RollbarContext's type is incomplete.

daniellzl avatar Mar 08 '23 23:03 daniellzl

I also have errors using <RollbarContext context="something"> with "react-router-dom": "6.11.2":

import { useRoutes } from 'react-router-dom';

return useRoutes([
{
  path: `${Route.Foo}/:bar`,
  element: (
    <RollbarContext context="/foo-bar">
      <FooBar />
    </RollbarContext>
  )
}
]);
Screenshot 2023-06-19 at 11 45 15

gazpachu avatar Jun 19 '23 10:06 gazpachu

cc @rollbar-bborsits (Juanjo Marrón suggested to ping you) to have a look at this 🙏

gazpachu avatar Jun 19 '23 13:06 gazpachu

cc @waltjones

gazpachu avatar Jun 26 '23 08:06 gazpachu

Hey @gazpachu @daniellzl, We'll need to analyze the proposed solution further. We'll get back to you.

ghost avatar Aug 01 '23 17:08 ghost