Skip to content

Conversation

thmsobrmlr
Copy link
Contributor

Problem

https://posthog.slack.com/archives/C0368RPHLQH/p1756732974736689

Changes

This adds a modal asking the user wether they want to use or discard the overrides when editing an insight.

FIXME: Unfortuntately I haven't yet been able to get this working with the various layouts/states that insights can be in right now. See the comment in code. I hope it will be easier fixing it once the layout changes are through, and then we can revisit this.

How did you test this code?

👉 Stay up-to-date with PostHog coding conventions for a smoother review.

@thmsobrmlr thmsobrmlr marked this pull request as draft September 12, 2025 13:46
Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

5 files reviewed, 3 comments

Edit Code Review Bot Settings | Greptile

Comment on lines +42 to +43
// we whould always have a short_id when overrides are present
if (insight.short_id) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

syntax: Typo: "whould" should be "would"

Suggested change
// we whould always have a short_id when overrides are present
if (insight.short_id) {
// we would always have a short_id when overrides are present

Comment on lines +65 to +66
// we whould always have a short_id when overrides are present
if (insight.short_id) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

syntax: Typo: "whould" should be "would"

Suggested change
// we whould always have a short_id when overrides are present
if (insight.short_id) {
// we would always have a short_id when overrides are present

Comment on lines +45 to +55
// :FIXME: This should work, but doesn't due to a race condition in insightsSceneLogic.
// What I _think_ is happening roughly: urlToAction gets called with the query, and calls updateQuery.
// Then setSceneState gets executed and calls the reloadInsightLogic listener. This then calls loadInsight,
// but the overrides are empty as the url doesn't have them any more. Now the query doesn't have the overrides as
// well.
urls.insightEdit(
insight.short_id,
currentLocation.searchParams.dashboard,
query
)
)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

logic: The FIXME comment indicates this code has a known race condition that prevents it from working correctly. This breaks the core functionality of editing with overrides.

Copy link
Contributor

Size Change: +129 B (0%)

Total Size: 2.73 MB

ℹ️ View Unchanged
Filename Size Change
frontend/dist/toolbar.js 2.73 MB +129 B (0%)

compressed-size-action

@posthog-bot
Copy link
Contributor

📸 UI snapshots have been updated

4 snapshot changes in total. 0 added, 4 modified, 0 deleted:

  • chromium: 0 added, 4 modified, 0 deleted (diff for shard 1)
  • webkit: 0 added, 0 modified, 0 deleted

Triggered by this commit.

👉 Review this PR's diff of snapshots.

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