-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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): remove filter based insights frontend side #24076
Conversation
c5c9543
to
5a40f2f
Compare
0c76cfa
to
c38d7d2
Compare
830a48b
to
27c601d
Compare
Size Change: +3.44 kB (+0.32%) Total Size: 1.08 MB
|
8c60cb1
to
a1dd6cd
Compare
📸 UI snapshots have been updated3 snapshot changes in total. 0 added, 3 modified, 0 deleted:
Triggered by this commit. |
📸 UI snapshots have been updated2 snapshot changes in total. 0 added, 2 modified, 0 deleted:
Triggered by this commit. |
📸 UI snapshots have been updated3 snapshot changes in total. 0 added, 3 modified, 0 deleted:
Triggered by this commit. |
# Conflicts: # frontend/__snapshots__/exporter-exporter--user-paths-insight--light.png
📸 UI snapshots have been updated3 snapshot changes in total. 0 added, 3 modified, 0 deleted:
Triggered by this commit. |
📸 UI snapshots have been updated1 snapshot changes in total. 0 added, 1 modified, 0 deleted:
Triggered by this commit. |
📸 UI snapshots have been updated3 snapshot changes in total. 0 added, 3 modified, 0 deleted:
Triggered by this commit. |
📸 UI snapshots have been updated2 snapshot changes in total. 0 added, 2 modified, 0 deleted:
Triggered by this commit. |
📸 UI snapshots have been updated1 snapshot changes in total. 0 added, 1 modified, 0 deleted:
Triggered by this commit. |
📸 UI snapshots have been updated1 snapshot changes in total. 0 added, 1 modified, 0 deleted:
Triggered by this commit. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A dizzying amount of changes 😵💫
I skimmed things and it looks alright. Just one question.
@@ -101,43 +102,51 @@ export const savedInsightsLogic = kea<savedInsightsLogicType>([ | |||
basic: true, | |||
} | |||
|
|||
const response = await api.get( | |||
const legacyResponse: CountedPaginatedResponse<InsightModel> = await api.get( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wondering why this would be a legacy response... wouldn't this also respond with a query based insight if it's updated on the backend-side?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, you're right - this will be a query based insight if it is already stored with a query
on the backend. legacyInsight
in this context means an insight that is potentially a legacy one. The conversion function will give precedence to a query
already present on an insight.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alright, good to know.
Unfortunately I haven't been able to slice-and-dice this any further :/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately I haven't been able to slice-and-dice this any further :/
No worries, this was more meant as appreciation of this ongoing diligent work.
return await api.update(`api/projects/${values.currentTeamId}/dashboards/${props.id}`, { | ||
filters: values.filters, | ||
}) | ||
const dashboard: DashboardType<InsightModel> = await api.update( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
probably a dumb question, why do all API responses still return InsightModel
and not QueryBasedInsightModel
? Do we need to wait on that till we run the db migration script
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No it's a good question. Basically QueryBasedInsightModel
is everything in InsightModel
, except filters
. This helped me see where we were still accessing filters in a converted model.
The reason that the backend endpoint are still typed as InsightModel
, is because they actually are. The backend side conversion is totally separate from the frontend side one. And you're right, we can change them once we ran the db migration script.
@@ -1034,7 +1049,7 @@ export const dashboardLogic = kea<dashboardLogicType>([ | |||
'force_cache', | |||
methodOptions | |||
) | |||
dashboardsModel.actions.updateDashboardInsight(polledInsight) | |||
dashboardsModel.actions.updateDashboardInsight(polledInsight!) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not following why we suddenly need the non null assertion here 😅
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I changed the type of the getSingleInsight
function (see line 134) above to be more in line with what it actually returns. The insight is only null if something went wrong and I didn't add error handling (we didn't have it before as well).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
aah missed that, thought it was unchanged. Thanks for explaining!
# Conflicts: # frontend/__snapshots__/scenes-app-insights--funnel-top-to-bottom-breakdown-edit--dark.png
Problem
We still have
filters
in the frontend.Changes
legacyInsight
usage, with exception of api handlers where we still get the legacy insightsInsightModel
in the same wayqueryBasedInsight
toinsight
readAsQuery
option fromfalse
totrue
everywhere -> the option will be removed in a follow upFollow-up
How did you test this code?