Skip to content

Commit

Permalink
Check nulls on board and active view when tracking telemetry events (m…
Browse files Browse the repository at this point in the history
…attermost-community#1738)

* Check nulls on board and active view when tracking telemetry events

* Update effect to trigger a track event when the board or the view change
  • Loading branch information
mgdelacroix authored Nov 3, 2021
1 parent 59413a9 commit cadbaf5
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion webapp/src/pages/boardPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -163,13 +163,20 @@ const BoardPage = (props: Props): JSX.Element => {
}
}, [board?.title, activeView?.title])

if (props.readonly) {
useEffect(() => {
if (board?.id && activeView?.id) {
TelemetryClient.trackEvent(TelemetryCategory, TelemetryActions.ViewSharedBoard, {board: board?.id, view: activeView?.id})
}
}, [board?.id, activeView?.id])
}

useEffect(() => {
let loadAction: any = initialLoad /* eslint-disable-line @typescript-eslint/no-explicit-any */
let token = localStorage.getItem('focalboardSessionId') || ''
if (props.readonly) {
loadAction = initialReadOnlyLoad
token = token || queryString.get('r') || ''
TelemetryClient.trackEvent(TelemetryCategory, TelemetryActions.ViewSharedBoard, {board: board.id, view: activeView.id})
}

dispatch(loadAction(match.params.boardId))
Expand Down

0 comments on commit cadbaf5

Please sign in to comment.