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

🪟 🐛 Remove reinitialization of AnalyticsService #19304

Merged
merged 4 commits into from
Nov 11, 2022

Conversation

timroes
Copy link
Contributor

@timroes timroes commented Nov 10, 2022

What

This cleans up the AnalyticsService to no longer reinitialize every time someone changes the context parameters on it.

We've noticed that in Segment a lot of the User.Create events are coming with experiments and - while not being able to reproduce fully - I suspect the issue here was, that as soon as we create a user/login we change the context, which itself will cause a new AnalyticsService to be recreated, while though some components that haven't rerendered might still send their events to the old instance with the old context.

Either way not recreating this class on every context change sounds like the better approach, so we should give this a try if it fixes our login problem.

I've validated that intercom still gets the correct workspace_id send as a property, as well as segment events still getting the right properties and they are changing correctly when e.g. changing workspace.

@timroes timroes added team/compose area/frontend Related to the Airbyte webapp ui/services labels Nov 10, 2022
@timroes timroes requested a review from a team as a code owner November 10, 2022 20:30
@@ -29,11 +29,11 @@ export const useIntercom = (): IntercomContextValues => {
useEffect(() => {
intercomContextValues.update({
customAttributes: {
workspace_id: analyticsContext.workspace_id,
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 likely never worked, since there was no workspace_id on that analytics context, but since it was also not typed it was never caught. Switched this to use the actual correct hook.

@timroes timroes marked this pull request as draft November 10, 2022 20:43
@octavia-squidington-iv octavia-squidington-iv added the area/platform issues related to the platform label Nov 11, 2022
@timroes timroes marked this pull request as ready for review November 11, 2022 11:30
@timroes timroes requested a review from josephkmh November 11, 2022 11:34
Copy link
Contributor

@josephkmh josephkmh left a comment

Choose a reason for hiding this comment

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

LGTM ✨ did not test locally

@timroes timroes merged commit 0af08f6 into master Nov 11, 2022
@timroes timroes deleted the tim/fix-analytics-service branch November 11, 2022 12:21
akashkulk pushed a commit that referenced this pull request Dec 2, 2022
* Remvoe reinitialization of AnalyticsService

* Change to ref

* Make useCurrentWorkspaceId work globally

* Fix workspace id
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/frontend Related to the Airbyte webapp area/platform issues related to the platform team/compose
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants