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

Enable persons modal on funnel trends #5133

Merged
merged 19 commits into from
Jul 20, 2021
Merged

Conversation

liyiy
Copy link
Contributor

@liyiy liyiy commented Jul 14, 2021

Changes

Please describe.
If this affects the frontend, include screenshots.

The API does allow for drop-off users to return but after talking with @clarkus, we decided to leave that as an option for a future iteration, since the funnel trends graph currently only visualizes conversions, aka people that didn't drop off.

Screen.Recording.2021-07-14.at.3.48.40.PM.mov

Checklist

  • All querysets/queries filter by Organization, by Team, and by User
  • Django backend tests
  • Jest frontend tests
  • Cypress end-to-end tests
  • Migrations are safe to run at scale (e.g. PostHog Cloud) – present proof if not obvious
  • New/changed UI is decent on smartphones (viewport width around 360px)

@timgl timgl temporarily deployed to posthog-pr-5133 July 14, 2021 19:56 Inactive
@timgl timgl temporarily deployed to posthog-pr-5133 July 15, 2021 19:25 Inactive
@liyiy liyiy requested a review from mariusandra July 15, 2021 19:26
@timgl timgl temporarily deployed to posthog-pr-5133 July 15, 2021 19:32 Inactive
@liyiy liyiy requested a review from EDsCODE July 15, 2021 20:21
@timgl timgl temporarily deployed to posthog-pr-5133 July 15, 2021 20:51 Inactive
@liyiy liyiy requested a review from alexkim205 July 15, 2021 20:54
@liyiy liyiy self-assigned this Jul 15, 2021
Copy link
Collaborator

@Twixes Twixes left a comment

Choose a reason for hiding this comment

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

I think it's okay, though not ideal, to only show people who converted – but definitely confusing for me if that's not clarified in the modal.

Copy link
Collaborator

@mariusandra mariusandra left a comment

Choose a reason for hiding this comment

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

Hey, I guess some of the comments here are still worth implementing

Plus I see this now with postgres:
https://github.com/PostHog/posthog/pull/5133/files/d146cae005a42ffb916b67fbd721e51869077851#r670820614

(not sure why I have the old tooltips...)

@liyiy liyiy removed the request for review from EDsCODE July 16, 2021 13:41
@timgl timgl temporarily deployed to posthog-pr-5133 July 18, 2021 01:29 Inactive
@timgl timgl temporarily deployed to posthog-pr-5133 July 19, 2021 13:30 Inactive
@timgl timgl temporarily deployed to posthog-pr-5133 July 19, 2021 14:04 Inactive
@liyiy liyiy requested review from mariusandra and Twixes July 19, 2021 14:40
@timgl timgl temporarily deployed to posthog-pr-5133 July 19, 2021 15:13 Inactive
@liyiy liyiy requested a review from mariusandra July 19, 2021 16:04
Copy link
Collaborator

@mariusandra mariusandra left a comment

Choose a reason for hiding this comment

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

Looks good to me. There's one type-narrowing-related comment I still managed to find during my last run at the code. Fine to improve later as well.

@mariusandra
Copy link
Collaborator

Oh, and enjoy the merge conflicts :D

@timgl timgl temporarily deployed to posthog-pr-5133 July 20, 2021 13:08 Inactive
@timgl timgl temporarily deployed to posthog-pr-5133 July 20, 2021 15:33 Inactive
(results, stepsWithNestedBreakdown, filters): FunnelStepWithNestedBreakdown[] =>
!!filters.breakdown
(results, stepsWithNestedBreakdown, filters): FunnelStepWithNestedBreakdown[] => {
if (!Array.isArray(results)) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This was causing a white screen of death for funnel time conversion because it was trying to spread an object of time conversion bin result values. This is a temporary-ish fix, I will take a deeper look in a different PR. Not this one... no more merge conflicts plz 😩


interface ChartFilterProps {
filters: FilterType
onChange: (chartFilter: ChartDisplayType) => void
onChange: (chartFilter: ChartDisplayType | FunnelVizType) => void
Copy link
Contributor

Choose a reason for hiding this comment

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

I think the addition of this type just confuses things, especially if they're going to be used interchangeably. My preferred approach would be to put everything in ChartDisplayType and do away with FunnelVizType, OR have e.g. ChartDisplayType.FUNNELS cover everything and have FunnelVizType make it more specific.

What do you think @mariusandra @alexkim205 ? I don't have a strong opinion here but feel like we should agree on a convention

Copy link
Contributor

Choose a reason for hiding this comment

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

Scratch that, I really think FunnelVizType should be removed. We already have ViewType.FUNNELS to describe funnels overall.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

that's where the typing will come from for funnel_viz_type, see this comment: #5133 (comment)

Copy link
Collaborator

Choose a reason for hiding this comment

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

To clarify, FunnelVizType is the type of funnel visualization (since that's separate from overarching visualizations (like Trends or Funnels) )

Although, valid question whether ChartFilterProps, the top level interface should expect top level visualisation type or specific-to-funnels visualization type as well.

Copy link
Contributor

Choose a reason for hiding this comment

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

Right, @neilkakkar , ViewType includes Trends, Stickiness, Funnels, Retention, etc. and corresponds to overall type of query.

Then ChartDisplayType describes, for instance, linear line graph, cumulative line graph, bar chart, pie, etc. and seems like the logical place to distinguish between time to convert, steps, and historical trends as those are "types of visualization".

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think it's also a little confusing to reuse ChartDisplayType for something like time conversion because that technically uses the ActionsLineGraphLinear display type and would also probably cause confusion on the frontend if we checked for insights === FUNNELS && display === ChartDisplayType.ActionsLineGraphLinear vs just funnel_viz_type === FunnelVizType.Trends/TimeConversion/whatever

Copy link
Contributor Author

Choose a reason for hiding this comment

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

but also agree we should make our chart/display type system easier to navigate in general :o

@timgl timgl temporarily deployed to posthog-pr-5133 July 20, 2021 16:06 Inactive
import { ChartDisplayType, ViewType } from '~/types'
import { ChartDisplayType, FunnelVizType, ViewType } from '~/types'

function isFunnelVizType(filter: FunnelVizType | ChartDisplayType): filter is FunnelVizType {
Copy link
Contributor

Choose a reason for hiding this comment

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

Again, previous comments about why we need ViewType and FunnelVizType and ChartDisplayType apply here.

Copy link
Contributor

@samwinslow samwinslow left a comment

Choose a reason for hiding this comment

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

LGTM I think we could just benefit from some clarity as to why ChartDisplayType can't do what we want FunnelVizType to do, because ViewType already has a catch-all for funnels.

@liyiy
Copy link
Contributor Author

liyiy commented Jul 20, 2021

@samwinslow

I agree adding another "what graph type is it" param is confusing, ideally we could've just kept the model of "display=FunnelsTimeToConvert" and updated the backend to check that instead of funnel_viz_type. But not 100% sure if that's ideal for the API?

I think the intention of funnel_viz_type is to add slightly more clarity to the relationship between the funnels parent type and its trends/steps/timetoconvert children types.

I can, however, create a new action that handles the funnel_viz_type param setting logic specifically, and maybe that'll improve things, but in another PR plz 😄

@liyiy liyiy merged commit 13cbf9f into master Jul 20, 2021
@liyiy liyiy deleted the funnel-trends-persons-modal branch July 20, 2021 17:21
@mariusandra
Copy link
Collaborator

Would something like work?

type TrendsDisplayType = ChartDisplayType // rename it
type ChartFilter = TrendsDisplayType | FunnelVizType

props = {
    onChange: (chartFilter: ChartFilter) => void
}

The idea behind keeping the two display types separate is that they're separate trends views with different dropdowns. The ChartDisplayType needs anyway some cleanup, and this seemed slightly outside the scope here.

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.

7 participants