Skip to content

: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.

fix(error-tracking): stop reload button throwing on issue detail (#80565)

posthog[bot]5f8fbdeb9fb8
diff --git a/frontend/src/queries/nodes/DataNode/dataNodeLogic.test.ts b/frontend/src/queries/nodes/DataNode/dataNodeLogic.test.ts
index a7c8e5da7c36..29b48d90b754 100644
--- a/frontend/src/queries/nodes/DataNode/dataNodeLogic.test.ts
+++ b/frontend/src/queries/nodes/DataNode/dataNodeLogic.test.ts
@@ -688,4 +688,34 @@ describe('dataNodeLogic', () => {
'posthog_ai'
)
})
+
+ it('drops a non-RefreshType refresh argument', async () => {
+ // A caller that wires loadData straight to onClick passes a React MouseEvent as refresh;
+ // it must never reach performQuery, or the query request body fails to serialize.
+ const query = setLatestVersionsOnQuery({
+ kind: NodeKind.EventsQuery,
+ select: ['*', 'event', 'timestamp'],
+ })
+ mockedQuery.mockResolvedValue({ results: [] })
+
+ logic = dataNodeLogic({ key: testUniqueKey, query })
+ logic.mount()
+ await expectLogic(logic).toDispatchActions(['loadDataSuccess'])
+ mockedQuery.mockClear()
+
+ logic.actions.loadData({ type: 'click', target: {} } as any)
+ await expectLogic(logic).toDispatchActions(['loadDataSuccess'])
+
+ expect(performQuery).toHaveBeenCalledWith(
+ query,
+ expect.anything(),
+ 'blocking',
+ expect.any(String),
+ expect.any(Function),
+ undefined,
+ undefined,
+ false,
+ undefined
+ )
+ })
})
diff --git a/frontend/src/queries/nodes/DataNode/dataNodeLogic.ts b/frontend/src/queries/nodes/DataNode/dataNodeLogic.ts
index 286ec5ca6e64..e2dab80972b7 100644
--- a/frontend/src/queries/nodes/DataNode/dataNodeLogic.ts
+++ b/frontend/src/queries/nodes/DataNode/dataNodeLogic.ts
@@ -144,6 +144,24 @@ export interface DataNodeLogicProps {
export const AUTOLOAD_INTERVAL = 30000
const LOAD_MORE_ROWS_LIMIT = 10000
+const VALID_REFRESH_TYPES: ReadonlySet<RefreshType> = new Set([
+ 'async',
+ 'async_except_on_cache_miss',
+ 'blocking',
+ 'force_async',
+ 'force_blocking',
+ 'force_cache',
+ 'lazy_async',
+])
+
+// Guards against callers that wire `loadData` straight to an event handler, so a React
+// MouseEvent (or any other non-RefreshType value) never reaches the query request body.
+function sanitizeRefreshType(refresh: unknown): RefreshType | undefined {
+ return typeof refresh === 'string' && VALID_REFRESH_TYPES.has(refresh as RefreshType)
+ ? (refresh as RefreshType)
+ : undefined
+}
+
const concurrencyController = new ConcurrencyController(1)
const webAnalyticsConcurrencyController = new ConcurrencyController(6)
const webAnalyticsPreAggConcurrencyController = new ConcurrencyController(6)
@@ -914,7 +932,7 @@ export const dataNodeLogic = kea<dataNodeLogicType>([
alreadyRunningQueryId?: string,
overrideQuery?: DataNode<Record<string, any>>
) => ({
- refresh,
+ refresh: sanitizeRefreshType(refresh),
queryId: alreadyRunningQueryId || uuid(),
pollOnly: !!alreadyRunningQueryId,
overrideQuery,
diff --git a/products/error_tracking/frontend/scenes/ErrorTrackingConfigurationScene/rules/RuleModal.tsx b/products/error_tracking/frontend/scenes/ErrorTrackingConfigurationScene/rules/RuleModal.tsx
index fedf0ad09dca..4665d95f59a9 100644
--- a/products/error_tracking/frontend/scenes/ErrorTrackingConfigurationScene/rules/RuleModal.tsx
+++ b/products/error_tracking/frontend/scenes/ErrorTrackingConfigurationScene/rules/RuleModal.tsx
@@ -128,7 +128,7 @@ export function RuleModal({
disabledReason={
!filtersOptional && !hasFilters ? 'Add at least one filter first' : undefined
}
- onClick={loadMatchCount}
+ onClick={() => loadMatchCount()}
>
Test rule
</LemonButton>
diff --git a/products/error_tracking/frontend/scenes/ErrorTrackingConfigurationScene/rules/Rules.tsx b/products/error_tracking/frontend/scenes/ErrorTrackingConfigurationScene/rules/Rules.tsx
index 429f7c5e9b38..73d92b1d48cc 100644
--- a/products/error_tracking/frontend/scenes/ErrorTrackingConfigurationScene/rules/Rules.tsx
+++ b/products/error_tracking/frontend/scenes/ErrorTrackingConfigurationScene/rules/Rules.tsx
@@ -129,7 +129,7 @@ const ReorderRules = (): JSX.Element | null => {
<LemonButton type="secondary" size="small" onClick={cancelReorderingRules}>
Cancel
</LemonButton>
- <LemonButton type="primary" size="small" onClick={finishReorderingRules} loading={rulesLoading}>
+ <LemonButton type="primary" size="small" onClick={() => finishReorderingRules()} loading={rulesLoading}>
Finish reordering
</LemonButton>
</>
diff --git a/products/error_tracking/frontend/scenes/ErrorTrackingIssueScene/IssueEventsPanel.tsx b/products/error_tracking/frontend/scenes/ErrorTrackingIssueScene/IssueEventsPanel.tsx
index 08cff882b6dd..63ad5679b217 100644
--- a/products/error_tracking/frontend/scenes/ErrorTrackingIssueScene/IssueEventsPanel.tsx
+++ b/products/error_tracking/frontend/scenes/ErrorTrackingIssueScene/IssueEventsPanel.tsx
@@ -86,7 +86,7 @@ function IssueEventsLayout({
size="icon"
loading={loading}
aria-label="Reload exceptions"
- onClick={onReload}
+ onClick={() => onReload?.()}
/>
}
>