Check nulls on board and active view when tracking telemetry events (#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
This commit is contained in:
Miguel de la Cruz 2021-11-03 16:22:22 +01:00 committed by GitHub
parent 59413a9fc4
commit cadbaf5724
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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))