-
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
feat(flags): Autoselect identified distinct ID in Person flags tab when possible #26857
Conversation
(s) => [s.person], | ||
(person): string | null => { | ||
// We do not track which distinct ID was created through identify, but we can try to guess | ||
const nonUuidDistinctIds = person?.distinct_ids.filter((id) => id?.split('-').length !== 5) |
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 went for the -
segment count instead of a UUID regex because the actual user request for this included some UUID-adjacent identifiers which were longer than 36 characters: https://posthog.slack.com/archives/C07Q2U4BH4L/p1733826806892899
Figured I'd keep this flexible 🤷
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.
yeah, this is a pretty good way of doing this IMO – I haven't seen any cases where the non-uuid distinct_id isn't the user-created distinct_id
, and defaulting to the first one in any other cases seems sane enough.
Furthermore, it looks like we do this on the backend, too, so you should feel extra validated by the choice you made ;)
Yes, it would be nice if we could be even more confident in this value (even if this is just a quality-of-life thing for users) but it's not worth blocking on.
Size Change: 0 B Total Size: 1.11 MB ℹ️ View Unchanged
|
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.
nice work, I think this is good enough to ship.
(s) => [s.person], | ||
(person): string | null => { | ||
// We do not track which distinct ID was created through identify, but we can try to guess | ||
const nonUuidDistinctIds = person?.distinct_ids.filter((id) => id?.split('-').length !== 5) |
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.
yeah, this is a pretty good way of doing this IMO – I haven't seen any cases where the non-uuid distinct_id isn't the user-created distinct_id
, and defaulting to the first one in any other cases seems sane enough.
Furthermore, it looks like we do this on the backend, too, so you should feel extra validated by the choice you made ;)
Yes, it would be nice if we could be even more confident in this value (even if this is just a quality-of-life thing for users) but it's not worth blocking on.
Yep only thing I can think of that would be better than this is a CH lookup for the last identify that occurred, but this seems a bit silly to block the UI for |
Problem
Context: https://posthog.slack.com/archives/C07Q2U4BH4L/p1733826806892899
On the backend we currently do not track which distinct ID was created through
identify
oralias
calls. When some users rack up many distinct IDs, it can be annoying to go look for the "identified" distinct ID in the list.Changes
👉 Stay up-to-date with PostHog coding conventions for a smoother review.
Does this work well for both Cloud and self-hosted?
Yes
How did you test this code?
Verified desired behavior when loading person profiles with: