Repository navigation
feat(sql-editor): update formatting immediately - #53055
Merged
Merged
Conversation
Contributor
|
Size Change: -26 B (0%) Total Size: 127 MB βΉοΈ View Unchanged
|
Contributor
Prompt To Fix All With AIThis is a comment left during a code review.
Path: frontend/src/scenes/data-warehouse/editor/sqlEditorLogic.tsx
Line: 1373-1389
Comment:
**Imperative side-effect inside a kea selector**
`getCurrentVisualizationQuery` calls `dataVisualizationLogic.findMounted(...)` β an imperative read of a different logic's live state β from inside a kea selector. Kea memoizes selectors based only on their declared inputs, so this selector is reactive only when `sourceQuery`, `activeTab`, `editingInsight`, or `dataLogicKey` change; changes to `dataVisualizationLogic`'s internal query that have not yet propagated through `props.setQuery β setSourceQuery` will be invisible.
In practice the two are kept in sync (the `axesChanged` listener always calls `props.setQuery`, which calls `setSourceQuery`), so there's no current bug. But this is a fragile coupling and the `as any` cast on line 165 already signals a type boundary mismatch. If `dataVisualizationLogic` is ever not mounted when the selector evaluates it silently falls back to `sourceQuery`, which is the correct safeguard.
Consider subscribing to `dataVisualizationLogic.values.query` explicitly as a kea dependency (via `connect`) to make the reactivity contract explicit, or add a brief comment explaining why the imperative lookup is safe here.
How can I resolve this? If you propose a fix, please make it concise.
---
This is a comment left during a code review.
Path: frontend/src/queries/nodes/DataVisualization/Components/SeriesTab.test.tsx
Line: 17-110
Comment:
**Prefer parameterised tests for multiple formatting fields**
The test only exercises `decimalPlaces`. Three of the four formatting fields (`prefix`, `suffix`, `style`) are now wired with the same pattern but go untested here. Per the project's style preference, a parameterised (`it.each`) test covering all four would be more thorough and keeps the scenario count low:
```ts
it.each([
['prefix', 'prefixInput', '$', { prefix: '$' }],
['suffix', 'suffixInput', 'USD', { suffix: 'USD' }],
['decimalPlaces', 'spinbutton', '2', { decimalPlaces: 2 }],
])('persists %s formatting changes immediately', async (...) => { ... })
```
This isn't a blocker, but would increase confidence that the `updateFormatting` path works for all fields, not just numerical ones.
How can I resolve this? If you propose a fix, please make it concise.Reviews (1): Last reviewed commit: "feat(sql-editor): update formatting imme..." | Re-trigger Greptile |
β¦ into sql-update-on-viz-change
Contributor
|
π Playwright report Β· View test results β
These issues are not necessarily caused by your changes. |
mariusandra
enabled auto-merge (squash)
April 2, 2026 17:08
andrewjmcgehee
approved these changes
Apr 2, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
https://posthog.slack.com/archives/C0ACRAMJUAG/p1774287410082209
When changing some of the visualization settings, the "update insight" button didn't activate.
Changes
Seems like we were mutating JS objects... Fixes that.
How did you test this code?
Clicked around + tests
Publish to changelog?
no, it's a bugfix
Docs update
not needed