Skip to content

fix(onboarding): instrumentation #9845

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

Merged
merged 1 commit into from
May 19, 2022
Merged

fix(onboarding): instrumentation #9845

merged 1 commit into from
May 19, 2022

Conversation

rcmarron
Copy link
Contributor

Problem

For onboarding, we want to have instrumentation for when a user starts ingesting events. Because experimentation only works in posthog-js, we need to fire this event from the front-end. Originally, it fired from the homepage logic, but the issue is that not everyone visits the homepage after ingesting events.

Changes

This PR:

  • Moves this event from the homepageLogic to the teamLogic
  • Does some decoupling between userLogic, preFlightLogic, teamLogic, and eventUsageLogic because of circular dependencies
  • Fixes some related tests that weren't testing what we thought they were

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

How did you test this code?

Verified the event fires and we don't hit circular dependency issues.

@rcmarron rcmarron requested a review from liyiy May 18, 2022 16:56
@@ -681,10 +685,27 @@ describe('eventsTableLogic', () => {
})

it('fires two actions to change state, but just one API.get', async () => {
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 test previously wasn't waiting for the fetchEventsSuccess action, so we were checking how many api calls were made before api calls were made. The one that was be counted was from the mount function.

The changes below clean this up.

Copy link
Contributor

Choose a reason for hiding this comment

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

🤦 . Thanks!

if (preflight) {
actions.loadPreflightSuccess(preflight)
} else if (!values.preflight) {
actions.loadPreflight()
}
if (switchedTeam) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Moved this to teamLogic to decouple things

@rcmarron rcmarron requested a review from neilkakkar May 18, 2022 16:59
Copy link
Contributor

@liyiy liyiy left a comment

Choose a reason for hiding this comment

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

looking good to me! let's see if neil catches anything first since he wrote the tests

@liyiy liyiy merged commit 4df3abf into master May 19, 2022
@liyiy liyiy deleted the logic-wrangling branch May 19, 2022 16:32
fuziontech added a commit that referenced this pull request May 19, 2022
* master:
  refactor(ingestion): Make `KAFKA_ENABLED` true by default and set `KAFKA_HOSTS` default (#9844)
  feat(apps): transpile frontend.tsx (#9828)
  feat: show api call status when adding insights to dashboards (#9817)
  feat: track metrics on zapier hook firings (#9866)
  fix(onboarding): instrumentation (#9845)
  feat(whitelabel-shared-dashboard): Hide branding on shared dashboards paid (#9849)
  fix(apps): plugin source quickfix (#9862)
  refactor(plugin-server): Remove `ts-jest`, use `jest.mocked` (#9861)
  refactor(plugin-server): Trigger public jobs with graphile insted of celery queue (#9811)
  chore: upgrade pip tools (#9859)
  feat(apps): plugin source in its own model, part 2 (#9854)
  chore: Update sprint_planning_retro.md (#9791)
  feat(apps): plugin source in its own model, part 1 (#9853)
  feat(matrix): Add option to save `simulate_matrix` like `setup_dev` (#9836)
  fix(cohort): add mapping from event to person (#9841)
  feat(person-on-events): Enable CI to run using both old and new queries (#9814)
alexkim205 pushed a commit that referenced this pull request May 23, 2022
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.

3 participants