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

chore: deduplicate subsequent identify calls #1649

Merged
merged 3 commits into from
Jan 16, 2025
Merged

Conversation

joshsny
Copy link
Contributor

@joshsny joshsny commented Jan 14, 2025

Often duplicate $identify calls are made due to the SDK being incorrectly setup in the app, or due to re-rendering of providers.

The current behaviour is to only deduplicate $identify calls with no properties, but most $identify calls include properties like email, so they are not deduplicated. This PR extends deduplication to calls with properties.

Note: this is my first contribution to js sdk so would appreciate a thorough review.
...

Checklist

  • Tests for new code (see advice on the tests we use)
  • Accounted for the impact of any changes across different browsers
  • [x ] Accounted for backwards compatibility of any changes (no breaking changes in posthog-js!)

Copy link

vercel bot commented Jan 14, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
posthog-js ✅ Ready (Inspect) Visit Preview Jan 14, 2025 6:04pm

Copy link

github-actions bot commented Jan 14, 2025

Size Change: +3.46 kB (+0.11%)

Total Size: 3.24 MB

Filename Size Change
dist/array.full.es5.js 264 kB +350 B (+0.13%)
dist/array.full.js 367 kB +346 B (+0.09%)
dist/array.full.no-external.js 365 kB +346 B (+0.09%)
dist/array.js 180 kB +345 B (+0.19%)
dist/array.no-external.js 179 kB +345 B (+0.19%)
dist/main.js 181 kB +345 B (+0.19%)
dist/module.full.js 367 kB +346 B (+0.09%)
dist/module.full.no-external.js 365 kB +346 B (+0.09%)
dist/module.js 180 kB +345 B (+0.19%)
dist/module.no-external.js 179 kB +345 B (+0.19%)
ℹ️ View Unchanged
Filename Size
dist/all-external-dependencies.js 207 kB
dist/customizations.full.js 12.6 kB
dist/dead-clicks-autocapture.js 14.4 kB
dist/exception-autocapture.js 9.48 kB
dist/external-scripts-loader.js 2.64 kB
dist/recorder-v2.js 115 kB
dist/recorder.js 115 kB
dist/surveys-preview.js 58.1 kB
dist/surveys.js 63.8 kB
dist/tracing-headers.js 1.76 kB
dist/web-vitals.js 10.4 kB

compressed-size-action

src/posthog-core.ts Outdated Show resolved Hide resolved
src/posthog-core.ts Outdated Show resolved Hide resolved
src/posthog-core.ts Outdated Show resolved Hide resolved
Copy link
Member

@pauldambra pauldambra left a comment

Choose a reason for hiding this comment

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

brain dumped from a quick scan... i've not really worked with identify so haven't thought about whether we should 🙈

Copy link
Member

@pauldambra pauldambra left a comment

Choose a reason for hiding this comment

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

was thinking about this...
i don't think it's breaking (even though it's technically breaking) because this is the behaviour that I think humans expect, so I don't think we need the hit on bundle size of adding config to opt in and slow rollout and all that jazz.

we should label as minor change though (that's what does CI here)

I didn't approve because I don't know why we shouldn't do it - which is too many double negatives - let's update docs on posthog.com and get @joethreepwood to put it in changelog

@pauldambra pauldambra added the bump minor Bump minor version when this PR gets merged label Jan 15, 2025
Copy link
Collaborator

@benjackwhite benjackwhite left a comment

Choose a reason for hiding this comment

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

Personally I think this makes total sense. I can't think of a reason why it wouldn't want to be this way, plus we have a warning logged for it so good from me

@joshsny joshsny merged commit 3b5e599 into main Jan 16, 2025
31 checks passed
@joshsny joshsny deleted the dedupe-identify-calls branch January 16, 2025 17:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bump minor Bump minor version when this PR gets merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants