feat(dynamic-grouping): Add current issue information to stack trace#106138
feat(dynamic-grouping): Add current issue information to stack trace#106138
Conversation
Displays the title etc of the issue that is being shown in the example stack trace section and lets you randomly view another.
|
|
||
| // eslint-disable-next-line react-you-might-not-need-an-effect/no-derived-state | ||
| setStackTraceGroupId(cluster.group_ids[0]!); | ||
| }, [cluster.group_ids]); |
There was a problem hiding this comment.
State not reset when group IDs become empty
Low Severity
The useEffect that syncs stackTraceGroupId with cluster.group_ids returns early when the array is empty, but doesn't reset the state to 0. If cluster.group_ids changes from a non-empty array to an empty one, stackTraceGroupId retains its stale value. Since the render condition is stackTraceGroupId > 0, this causes the component to attempt rendering a stack trace for a group ID that no longer belongs to the cluster.
| next = cluster.group_ids[Math.floor(Math.random() * cluster.group_ids.length)]!; | ||
| } | ||
| return next; | ||
| }); |
There was a problem hiding this comment.
Potential infinite loop with duplicate group IDs
Low Severity
The handleRandomizeStackTrace while loop only exits when a different ID is found (next !== prev). If cluster.group_ids contains duplicate values (e.g., [123, 123]), the loop has no exit condition and will run forever, freezing the browser. While group IDs are expected to be unique, the algorithm has no safeguard like a maximum iteration count to prevent this scenario.
Displays the title etc of the issue that is being shown in the example stack trace section and lets you randomly view another.