Skip to content

Commit 7bcd00f

Browse files
alwxsentrivana
authored andcommitted
docs(react-native): Update useDispatchedActionData description (#17320)
Update the React Navigation integration docs to reflect the new behavior of `useDispatchedActionData`: - **Immediate span naming** from action payload (`NAVIGATE`, `PUSH`, `REPLACE`, `JUMP_TO`) - **Skip spans** for actions without a known route name (`GO_BACK`, `POP`, `POP_TO_TOP`, `RESET`) - **Filter non-navigation actions** (`SET_PARAMS`, drawer actions) - Clarified that `goBack` transactions are skipped when the option is enabled Ref: getsentry/sentry-react-native#5982
1 parent e6ce39d commit 7bcd00f

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

docs/platforms/react-native/tracing/instrumentation/react-navigation.mdx

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,18 @@ This ensures that transactions that are from routes that've been seen and don't
3939

4040
### useDispatchedActionData
4141

42-
This option defines whether to use the dispatched action data to populate the transaction metadata. When set to true, the integration will filter out navigation actions that should not create spans. The default value is `false`.
42+
This option defines whether to use the dispatched action data to populate the transaction metadata. When set to true, the integration will:
43+
44+
- **Name spans immediately** using the route name from the action payload (e.g., `NAVIGATE`, `PUSH`, `REPLACE`, `JUMP_TO` actions carry `payload.name`). The span name is updated with the final route once the router processes the action.
45+
- **Skip spans for actions without a known route name** (e.g., `GO_BACK`, `POP`, `POP_TO_TOP`, `RESET`), reducing noise.
46+
- **Filter out non-navigation actions** (e.g., `SET_PARAMS`, `OPEN_DRAWER`, `CLOSE_DRAWER`, `TOGGLE_DRAWER`) that should not create spans.
47+
48+
The default value is `false`.
4349

4450
## Notes
4551

4652
- This instrumentation supports React Navigation version 5 and above. Starting with SDK version 6, React Navigation version 4 will no longer be supported. Please upgrade.
4753

48-
- The instrumentation creates a transaction on every route change including `goBack` navigations.
54+
- The instrumentation creates a transaction on every route change including `goBack` navigations. When `useDispatchedActionData` is enabled, `goBack` and other actions without a known target route are skipped.
4955

5056
- If you are coming from a version prior to 2.3.0, make sure you update where `registerNavigationContainer` is called. For more detailed instructions, see [our migration guide](/platforms/react-native/migration/#react-navigation-instrumentation-from-230).

0 commit comments

Comments
 (0)