Repository navigation
Conversation
Prompt To Fix All With AIFix the following 2 code review issues. Work through them one at a time, proposing concise fixes.
---
### Issue 1 of 2
frontend/src/scenes/surveys/surveysLogic.tsx:344
**`survey_id` metadata will always be `"undefined"`**
`deleteSurvey` returns the merged data object `{ ...values.data, surveys: ..., searchSurveys: ... }` (lines 197β201). In kea-loaders the `...Success` action payload is `{ data: <returnValue> }` (confirmed by the reducer on line 315 using `(_, { data })`). Destructuring `{ payload: surveyId }` from `{ data: {...} }` produces `surveyId = undefined`, so `String(undefined)` = `"undefined"` is sent as `survey_id`. The intended survey ID is only available as the `id` argument passed into the loader, not from what the loader returns.
### Issue 2 of 2
frontend/src/scenes/feature-flags/cohortPickerProps.ts:20
The constant name `COHORTS_ONLY_SUPPORT_IN_PICKER_PROPS` now contradicts the updated JSDoc and the implementation β `not_in` is no longer excluded. Future readers will assume `not_in` is still filtered out.
```suggestion
export const COHORTS_PICKER_PROPS = {
```
Reviews (1): Last reviewed commit: "fix(insights): hide math/SQL tag in lege..." | Re-trigger Greptile |
| @@ -15,9 +15,9 @@ import { PropertyOperator } from '~/types' | |||
| * | |||
| * Spread into `PropertyFilters` / `TaxonomicPropertyFilter` rather than | |||
| * passing each prop individually so the configuration travels as one named | |||
| * idea and a future change (e.g. allowing `not_in`) edits one place. | |||
| * idea and a future change edits one place. | |||
| */ | |||
| export const COHORTS_ONLY_SUPPORT_IN_PICKER_PROPS = { | |||
There was a problem hiding this comment.
The constant name
COHORTS_ONLY_SUPPORT_IN_PICKER_PROPS now contradicts the updated JSDoc and the implementation β not_in is no longer excluded. Future readers will assume not_in is still filtered out.
| export const COHORTS_ONLY_SUPPORT_IN_PICKER_PROPS = { | |
| export const COHORTS_PICKER_PROPS = { |
Prompt To Fix With AI
This is a comment left during a code review.
Path: frontend/src/scenes/feature-flags/cohortPickerProps.ts
Line: 20
Comment:
The constant name `COHORTS_ONLY_SUPPORT_IN_PICKER_PROPS` now contradicts the updated JSDoc and the implementation β `not_in` is no longer excluded. Future readers will assume `not_in` is still filtered out.
```suggestion
export const COHORTS_PICKER_PROPS = {
```
How can I resolve this? If you propose a fix, please make it concise.f455f3c to
4b6044a
Compare
|
This PR hasn't seen activity in a week! Should it be merged, closed, or further worked on? If you want to keep it open, please remove the |
|
Still relevant β bumping to prevent auto-close. |
haacked
left a comment
There was a problem hiding this comment.
Nice, targeted fix for the legend. One blocking issue inline: the same gate also fires in tooltips, which the description says it leaves alone. A couple of suggestions too.
4b6044a to
3a49805
Compare
|
Thanks @haacked β addressed both points: Blocking fix: Replaced the Suggestion addressed: Scoped the hide to The Test for |
|
hey @haacked β pushed the fixes last week, mind taking another look when you get a chance? |
|
This PR hasn't seen activity in a week! Should it be merged, closed, or further worked on? If you want to keep it open, please remove the |
When a series uses a SQL calculation (math=hogql) and has a custom name, the legend showed both the custom name and the full SQL expression as a tag, making the legend take up excessive space and cramping the chart. The custom name is the user's explicit label for the series, so the math tag is redundant when showSingleName is true (the legend's mode). Suppress the MathTag when showSingleName and action.custom_name are both set. Contexts that don't pass showSingleName (tooltips, etc.) are unaffected. Fixes PostHog#58907
β¦ooltips The previous approach used showSingleName to gate the math tag, but both legend rows and tooltips pass showSingleName=true, so tooltips also had the tag hidden (unintended). Two issues addressed per review from @haacked: - Add hideMathTagWhenCustomName prop passed only by InsightLegendRow, not InsightTooltip, so tooltips are unaffected - Scope the hide to math=hogql only β short tags like 'Average' on a renamed series should still show; only the long SQL expression is suppressed
3a49805 to
cb325a0
Compare
|
addressed all the feedback β switched from |
The prop only suppresses the HogQL/SQL expression tag, gated on math === 'hogql'. The old name implied it hid any math tag under a custom name; the new name matches the actual behavior. Claude-Session: https://claude.ai/code/session_015RyuRuvkysWRwMA86t6do8
Pins the four-way condition: the SQL expression tag is hidden only when the flag is on, the series has a custom name, and math is hogql; it stays visible by default, without a custom name, and for non-hogql math. Claude-Session: https://claude.ai/code/session_015RyuRuvkysWRwMA86t6do8
haacked
left a comment
There was a problem hiding this comment.
All my feedback was addressed. Nice work!
β¦ame (#58946) Co-authored-by: Phil Haack <phil.h@posthog.com>
Problem
When a series uses a SQL calculation (
math=hogql) and has a custom name set, the chart legend renders both the custom name and the full SQL expression as a tag side-by-side. For long SQL expressions likeuniqExact(properties.timing_group_id), this makes the legend consume half the chart area.The same issue occurs with long built-in math options like "First occurrence matching filters".
Fixes #58907
Changes
One condition change in
InsightLabel/index.tsx. TheMathTagis already conditionally rendered β added a check that suppresses it whenshowSingleNameistrue(the legend's mode) andaction.custom_nameis set.Before: math tag always shown when
action.math !== 'total'After: math tag hidden when
showSingleName && action.custom_nameβ the custom name is already the user's chosen description of the seriesContexts that don't pass
showSingleName(tooltips, the query editor) are unaffected.How did you test this code?
TypeScript compilation passes. Manual testing requires a series with
math=hogqland a custom name set β the legend should show only the custom name without the SQL tag.Publish to changelog?
No
π€ Agent context
Authored with Claude Code. Traced the legend rendering path from
InsightLegendRowβInsightLabelβMathTag. TheshowSingleNameprop already suppresses the underlying event name inEntityFilterInfowhen a custom name is set; this PR applies the same logic to theMathTag.