From b257b6691aec2e29a77e06cb3d95d94b7eec12ba Mon Sep 17 00:00:00 2001 From: Adeel Khan Date: Thu, 28 Jan 2021 03:58:35 +0500 Subject: [PATCH] Fix multiple event firing on rerenders. This would fix multiple GA event firing on component rerendering. Moving it to constructor would invoke it once on page load. --- src/login/LoginPage.jsx | 2 +- src/register/RegistrationPage.jsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/login/LoginPage.jsx b/src/login/LoginPage.jsx index b403af3c..75119ddf 100644 --- a/src/login/LoginPage.jsx +++ b/src/login/LoginPage.jsx @@ -32,6 +32,7 @@ class LoginPage extends React.Component { constructor(props, context) { super(props, context); + sendPageEvent('login_and_registration', 'login'); this.state = { password: '', email: '', @@ -170,7 +171,6 @@ class LoginPage extends React.Component { ); } - sendPageEvent('login_and_registration', 'login'); return ( <>