From d4c86a981b3ea03f40fec07cad3002b8c8b697f0 Mon Sep 17 00:00:00 2001 From: Dylan Martin Date: Tue, 24 Sep 2024 17:33:16 -0400 Subject: [PATCH] Revert "fix(sidepanel): parse the stringified JSON from the `getFeatureFlagPayload` response" (#25184) --- .../activity/sidePanelActivityLogic.tsx | 22 ++++++------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/frontend/src/layout/navigation-3000/sidepanel/panels/activity/sidePanelActivityLogic.tsx b/frontend/src/layout/navigation-3000/sidepanel/panels/activity/sidePanelActivityLogic.tsx index 15eb930bf1c81..f1ad08ff772cf 100644 --- a/frontend/src/layout/navigation-3000/sidepanel/panels/activity/sidePanelActivityLogic.tsx +++ b/frontend/src/layout/navigation-3000/sidepanel/panels/activity/sidePanelActivityLogic.tsx @@ -200,20 +200,11 @@ export const sidePanelActivityLogic = kea([ let changelogNotification: ChangelogFlagPayload | null = null const flagPayload = posthog.getFeatureFlagPayload('changelog-notification') - // `getFeatureFlagPayload` ostensibly returns a JsonType, but in practice it's a stringified JSON object, - // so we need to parse it before checking for the presence of the required fields. - if (typeof flagPayload === 'string') { - try { - const parsedPayload = JSON.parse(flagPayload) - if (parsedPayload.markdown && parsedPayload.notificationDate) { - changelogNotification = { - markdown: parsedPayload.markdown, - notificationDate: dayjs(parsedPayload.notificationDate), - } as ChangelogFlagPayload - } - } catch (e) { - console.error('Failed to parse changelog notification payload', e) - } + if (flagPayload) { + changelogNotification = { + markdown: flagPayload['markdown'], + notificationDate: dayjs(flagPayload['notificationDate']), + } as ChangelogFlagPayload } if (changelogNotification) { @@ -237,8 +228,9 @@ export const sidePanelActivityLogic = kea([ return 1 } else if (a.created_at.isAfter(b.created_at)) { return -1 + } else { + return 0 } - return 0 }) return notifications }