Open itsramiel opened 5 months ago
cc @PostHog/team-feature-success
Hi @itsramiel thanks for flagging - it seems like we don't yet handle automatically updating flag props in RN yet.
For now, you can get around this by calling setPersonPropertiesForFlags
manually whenever you're adding $set
to events - this will keep them in sync properly.
Hey @neilkakkar
That seems to do the job. Do I still need to call flush
now or do I drop that from my implementation? It seems to work without it, but interested in knowing what you think
You don't need to flush, but since this is running on the client, I'd recommend flushing anyway (no need to await it though) so you're not losing events for whatever reason (like force quit, etc. etc.). One other reason can be syncing across devices - if the user shows up on both say ios/android/web, and you don't want the survey to show again everywhere, the faster the event makes it in, the faster things will be in sync.
But if this is not a concern, you're all good 👌 .
I'll keep this ticket open anyway for now to implement this bit automatically.
Bug description
I am using using user properties to match surveys to a specific user. For example i setup a survey to be shown only if
survey_shown/{survey_id}
is not set as a property on the user.The issue is that when I set the user property as I capture an event like so:
and flush the events with
await posthog.flush();
the feature flags are not immediately correct and the survey matching is incorrect as a result. It takes some time(second or two) for the feature flags to become correct and correctly match the surveys. This leads to issues where I show the survey multiple times or I dont show a survey that was dependent on the previous survey.How to reproduce
survey_shown/{survey if of created survey} is not set
call the following function twice while awaiting each call to ensure flushing occurred:
Related sub-libraries
Additional context
Complete App: