Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(insights): support editing insights by updating source #23092

Merged
merged 6 commits into from
Jun 25, 2024

Conversation

nikitaevg
Copy link
Contributor

Problem

#17839

Changes

Propagate insight changes if changes come from the source editor.

The solution is not very pretty, but it's the best I could come up with. So in Insight we create the setQuery callback that updates the query if it's not an InsightQueryViz. This if is needed because if it is an InsightQueryViz, setQuery is already called from another place, and calling here setQuery will cause an infinite recursion. Recursion happens because we set setQuery here and then here is where the recursion happens, props.setQuery is exactly the action.setQuery. I understand the explanation could not be less clear, but I hope nobody will read it.

Does this work well for both Cloud and self-hosted?

Yes

How did you test this code?

A Cypress test + manually (see the screencast).

@Twixes Twixes requested a review from a team June 19, 2024 20:41
frontend/src/queries/Query/Query.tsx Outdated Show resolved Hide resolved
@thmsobrmlr thmsobrmlr enabled auto-merge (squash) June 25, 2024 08:47
@thmsobrmlr thmsobrmlr merged commit f237981 into PostHog:master Jun 25, 2024
88 of 89 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants