From cadbaf57246cf60414f1c93ddd1714bf2bff5866 Mon Sep 17 00:00:00 2001 From: Miguel de la Cruz Date: Wed, 3 Nov 2021 16:22:22 +0100 Subject: [PATCH] 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 --- webapp/src/pages/boardPage.tsx | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/webapp/src/pages/boardPage.tsx b/webapp/src/pages/boardPage.tsx index b6e8cc26e..4792a8d9d 100644 --- a/webapp/src/pages/boardPage.tsx +++ b/webapp/src/pages/boardPage.tsx @@ -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))