posthog-node 4.5.1 → 4.5.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Next
2
2
 
3
+ # 4.5.2 - 2025-02-12
4
+
5
+ ## Fixed
6
+
7
+ 1. fix: Fixed edge case where `$feature_flag_called` events were enriched with additional feature flag data when they shouldn't be.
8
+
3
9
  # 4.5.1 - 2025-02-12
4
10
 
5
11
  ## Fixed
package/lib/index.cjs.js CHANGED
@@ -7,7 +7,7 @@ var node_fs = require('node:fs');
7
7
  var node_readline = require('node:readline');
8
8
  var node_path = require('node:path');
9
9
 
10
- var version = "4.5.1";
10
+ var version = "4.5.2";
11
11
 
12
12
  var PostHogPersistedProperty;
13
13
  (function (PostHogPersistedProperty) {
@@ -3000,8 +3000,12 @@ class PostHog extends PostHogCoreStateless {
3000
3000
  // return await super.getFeatureFlagsStateless(distinctId, groups, undefined, undefined, disableGeoip)
3001
3001
  return await _getFlags(distinctId, groups, disableGeoip);
3002
3002
  }
3003
+ if (event === '$feature_flag_called') {
3004
+ // If we're capturing a $feature_flag_called event, we don't want to enrich the event with cached flags that may be out of date.
3005
+ return {};
3006
+ }
3003
3007
  if ((this.featureFlagsPoller?.featureFlags?.length || 0) > 0) {
3004
- // Otherwise we may as well check for the flags locally and include them if there
3008
+ // Otherwise we may as well check for the flags locally and include them if they are already loaded
3005
3009
  const groupsWithStringValues = {};
3006
3010
  for (const [key, value] of Object.entries(groups || {})) {
3007
3011
  groupsWithStringValues[key] = String(value);