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

refactor(insights): move to queries in new insight urls #24193

Merged
merged 34 commits into from
Aug 13, 2024

Conversation

thmsobrmlr
Copy link
Contributor

@thmsobrmlr thmsobrmlr commented Aug 5, 2024

Problem

We'd like to get rid of filters, but still have them in URLs generated internally.

Changes

  • Replaces all internal links to #filters= type urls with query based #q=... type urls.
  • Drops support for old ?filters=... type urls.
  • Changes the "Leave insight?" confirmation for new insights to be based on a reducer that stores the query when first navigating to the insight. This is so that when navigating to a new insight e.g. from web analytics you can freely navigate away if you haven't changed anything.

How did you test this code?

  • Create a new insight from the dropdown menu on the saved insights page for each insight type
  • Create a new insight from the buttons on the web analytics page
  • Create a new insight by visiting a URL with a query in hash params in a new browser window

@posthog-bot
Copy link
Contributor

📸 UI snapshots have been updated

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

Triggered by this commit.

👉 Review this PR's diff of snapshots.

Copy link
Contributor

github-actions bot commented Aug 6, 2024

Size Change: +241 B (+0.02%)

Total Size: 1.07 MB

ℹ️ View Unchanged
Filename Size Change
frontend/dist/toolbar.js 1.07 MB +241 B (+0.02%)

compressed-size-action

@posthog-bot
Copy link
Contributor

📸 UI snapshots have been updated

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

  • chromium: 0 added, 2 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.

@posthog-bot
Copy link
Contributor

📸 UI snapshots have been updated

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

  • chromium: 0 added, 2 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.

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

@posthog-bot
Copy link
Contributor

📸 UI snapshots have been updated

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

  • chromium: 0 added, 2 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.

thmsobrmlr and others added 4 commits August 8, 2024 10:31
# Conflicts:
#	frontend/__snapshots__/exporter-exporter--user-paths-insight--light.png
@posthog-bot
Copy link
Contributor

📸 UI snapshots have been updated

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

  • chromium: 0 added, 2 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.

@posthog-bot
Copy link
Contributor

📸 UI snapshots have been updated

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

  • chromium: 0 added, 2 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.

@@ -1226,20 +1228,12 @@ export const webAnalyticsLogic = kea<webAnalyticsLogicType>([
if (!tab) {
throw new Error('Developer Error, tab not found')
}
return urls.insightNew(
{ properties: webAnalyticsFilters, date_from: dateFrom, date_to: dateTo },
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@robbie-c I couldn't figure out what adding the properties here does. Any hints for me?

Copy link
Member

Choose a reason for hiding this comment

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

It should copy the property filters from web analytics into the new insight

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not sure if I understand this correctly, but property filters should already be part of the queries set on the new insight. Let me know if this breaks anything that I don't see right now and I'm happy to adapt accordingly.

Copy link
Member

Choose a reason for hiding this comment

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

Ah you're right, looks like it wasn't necessary. I suspect I just passed these arguments in because they were there :) Just ran these changes locally and they worked fine, so all good from me

@posthog-bot
Copy link
Contributor

📸 UI snapshots have been updated

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

  • chromium: 0 added, 2 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.

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

thmsobrmlr and others added 3 commits August 8, 2024 16:02
# Conflicts:
#	frontend/__snapshots__/exporter-exporter--user-paths-insight--dark.png
#	frontend/__snapshots__/exporter-exporter--user-paths-insight--light.png
@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.

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

@posthog-bot
Copy link
Contributor

📸 UI snapshots have been updated

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

  • chromium: 0 added, 2 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.

# Conflicts:
#	frontend/src/scenes/web-analytics/webAnalyticsLogic.tsx
@thmsobrmlr thmsobrmlr marked this pull request as ready for review August 9, 2024 14:27
@thmsobrmlr thmsobrmlr requested a review from a team August 9, 2024 14:27
@@ -190,7 +205,7 @@ export const insightSceneLogic = kea<insightSceneLogicType>([
'/insights/:shortId(/:mode)(/:subscriptionId)': (
{ shortId, mode, subscriptionId }, // url params
{ dashboard, ...searchParams }, // search params
{ filters: _filters, q }, // hash params
{ insight: insightType, q }, // hash params
Copy link
Contributor

Choose a reason for hiding this comment

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

why do we want to support hash params and not just search params?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

no reason in particular here - just taking over the existing system. hash params are quite common for client-side state and afaik there's a higher limit for the number of characters.

@thmsobrmlr thmsobrmlr merged commit f403b17 into master Aug 13, 2024
95 checks passed
@thmsobrmlr thmsobrmlr deleted the insight-new-query branch August 13, 2024 06:09
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.

4 participants