<RollbarContext /> implementation doesn't match docs
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.
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>
)
}
]);
cc @rollbar-bborsits (Juanjo Marrón suggested to ping you) to have a look at this 🙏
cc @waltjones
Hey @gazpachu @daniellzl, We'll need to analyze the proposed solution further. We'll get back to you.