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 a crash

Blue Mousec3780cfc1fd8
diff --git a/src/pages/Project/Alerts/View/ProjectAlertsView.container.jsx b/src/pages/Project/Alerts/View/ProjectAlertsView.container.jsx
index 476179d1a..c3c417e7e 100644
--- a/src/pages/Project/Alerts/View/ProjectAlertsView.container.jsx
+++ b/src/pages/Project/Alerts/View/ProjectAlertsView.container.jsx
@@ -7,6 +7,7 @@ const mapStateToProps = (state) => ({
loading: state.ui.alerts.loading,
user: state.auth.user,
total: state.ui.alerts.total,
+ authenticated: state.auth.authenticated,
})
export default connect(mapStateToProps)(ProjectAlerts)
diff --git a/src/pages/Project/Alerts/View/ProjectAlertsView.jsx b/src/pages/Project/Alerts/View/ProjectAlertsView.jsx
index 21f894ea2..c281de524 100644
--- a/src/pages/Project/Alerts/View/ProjectAlertsView.jsx
+++ b/src/pages/Project/Alerts/View/ProjectAlertsView.jsx
@@ -23,14 +23,14 @@ import PaidFeature from 'modals/PaidFeature'
import { QUERY_METRIC, PLAN_LIMITS } from 'redux/constants'
const ProjectAlerts = ({
- projectId, alerts, loading, user, total,
+ projectId, alerts, loading, user, total, authenticated,
}) => {
const { t, i18n: { language } } = useTranslation()
const [isPaidFeatureOpened, setIsPaidFeatureOpened] = useState(false)
const history = useHistory()
- const limits = PLAN_LIMITS[user.planCode]
- const isLimitReached = total >= limits.maxAlerts
+ const limits = PLAN_LIMITS[user?.planCode]
+ const isLimitReached = authenticated && (total >= limits?.maxAlerts)
const projectAlerts = useMemo(() => {
if (loading) return []
@@ -176,6 +176,7 @@ ProjectAlerts.propTypes = {
loading: PropTypes.bool.isRequired,
user: PropTypes.object.isRequired,
total: PropTypes.number.isRequired,
+ authenticated: PropTypes.bool.isRequired,
}
export default memo(ProjectAlerts)