Skip to content

📈 Open source, privacy-first web analytics — a cookie-less Google Analytics alternative with built-in error tracking and performance monitoring. Self-host it or use our cloud. Get started for free!

fixed linting issues

Blue Mouse553100cdd2de
diff --git a/src/pages/MainPage/Pricing.jsx b/src/pages/MainPage/Pricing.jsx
index 1074e8240..c44a17fbb 100644
--- a/src/pages/MainPage/Pricing.jsx
+++ b/src/pages/MainPage/Pricing.jsx
@@ -4,8 +4,6 @@ import { Link } from 'react-router-dom'
import { CheckIcon } from '@heroicons/react/solid'
import _map from 'lodash/map'
import _isNil from 'lodash/isNil'
-import _isString from 'lodash/isString'
-import _isEmpty from 'lodash/isEmpty'
import _findIndex from 'lodash/findIndex'
import cx from 'clsx'
@@ -80,34 +78,34 @@ const Pricing = ({ t, language }) => {
const [planCodeLoading, setPlanCodeLoading] = useState(null)
const tiers = getTiers(t)
- const lastEventHandler = async (data) => {
- if (_isNil(data)) {
- return
- }
-
- if (data.event === 'Checkout.Complete') {
- // giving some time to the API to process tier upgrate via Paddle webhook
- setTimeout(async () => {
- try {
- const me = await authMe()
+ useEffect(() => {
+ const lastEventHandler = async (data) => {
+ if (_isNil(data)) {
+ return
+ }
- dispatch(authActions.loginSuccess(me))
- dispatch(authActions.finishLoading())
- } catch (e) {
- dispatch(authActions.logout())
- }
-
- dispatch(alertsActions.accountUpdated('The subscription has been upgraded.'))
- }, 1000)
- setPlanCodeLoading(null)
- } else if (data.event === 'Checkout.Close') {
- setPlanCodeLoading(null)
+ if (data.event === 'Checkout.Complete') {
+ // giving some time to the API to process tier upgrate via Paddle webhook
+ setTimeout(async () => {
+ try {
+ const me = await authMe()
+
+ dispatch(authActions.loginSuccess(me))
+ dispatch(authActions.finishLoading())
+ } catch (e) {
+ dispatch(authActions.logout())
+ }
+
+ dispatch(alertsActions.accountUpdated('The subscription has been upgraded.'))
+ }, 1000)
+ setPlanCodeLoading(null)
+ } else if (data.event === 'Checkout.Close') {
+ setPlanCodeLoading(null)
+ }
}
- }
- useEffect(() => {
lastEventHandler(lastEvent)
- }, [lastEvent])
+ }, [lastEvent, dispatch])
const onPlanChange = (tier) => {
if (planCodeLoading === null && user.planCode !== tier.planCode) {