From e9955bb03603ea3ad2fa15bc0a175329c8bf2208 Mon Sep 17 00:00:00 2001 From: Li Yi Yu Date: Mon, 25 Sep 2023 20:18:03 -0400 Subject: [PATCH] return early for undefined surveys --- src/posthog-surveys.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/posthog-surveys.ts b/src/posthog-surveys.ts index 20801da35..76cfdf657 100644 --- a/src/posthog-surveys.ts +++ b/src/posthog-surveys.ts @@ -29,6 +29,9 @@ export class PostHogSurveys { getActiveMatchingSurveys(callback: SurveyCallback, forceReload = false) { this.getSurveys((surveys) => { + if (!surveys) { + return callback([]) + } const activeSurveys = surveys.filter((survey) => { return !!(survey.start_date && !survey.end_date) })