:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
fix(homepage): guard scene log views loader against non-array response (#71794)
posthog[bot]e5b7cdd07822
diff --git a/frontend/src/lib/api.ts b/frontend/src/lib/api.tsindex 48b5e5b39379..1326eedeb9ac 100644--- a/frontend/src/lib/api.ts+++ b/frontend/src/lib/api.ts@@ -2552,7 +2552,10 @@ const api = {if (Object.keys(query).length) {request.withQueryString(query)}- return await request.get({ signal })+ const response = await request.get({ signal })+ // Guard the declared array contract: an edge/error response (or a stale bundle) may+ // return a non-array, which would break callers that iterate over the result.+ return Array.isArray(response) ? response : []},async create(data: { ref?: string; type?: string }): Promise<FileSystemEntry> {return await new ApiRequest().fileSystemLogView().create({ data })diff --git a/frontend/src/models/recentItemsModel.ts b/frontend/src/models/recentItemsModel.tsindex ecb33b099bc1..4cfc2cd24df2 100644--- a/frontend/src/models/recentItemsModel.ts+++ b/frontend/src/models/recentItemsModel.ts@@ -142,7 +142,7 @@ export const recentItemsModel = kea<recentItemsModelType>(['loadSceneLogViews timed out')const record: Record<string, string> = {}- for (const { ref, viewed_at } of results) {+ for (const { ref, viewed_at } of Array.isArray(results) ? results : []) {const current = record[ref]if (!current || Date.parse(viewed_at) > Date.parse(current)) {record[ref] = viewed_at