PostHog / posthog-js-lite

Reimplementation of posthog-js to be as light and modular as possible.
https://posthog.com/docs/libraries
MIT License
69 stars 36 forks source link

fix(flags): Handle payloads correctly #219

Closed neilkakkar closed 7 months ago

neilkakkar commented 7 months ago

Problem

Fixes https://github.com/PostHog/posthog/issues/21768

Noticed payloads are handled very messily, and some existing tests for these were wrong 🫠. Now always simulates how things should be in production, with the decide response returning stringified payloads.

The code now always parses payloads once: when we get the response from decide (or local eval), and everything else can assume the payload is an object. This means we don't need to faff around parsing everywhere, which is nice.

Ran locally against production and can confirm everything works nicely now.

Changes

Release info Sub-libraries affected

Bump level

Libraries affected

Changelog notes

github-actions[bot] commented 7 months ago

Size Change: +121 B (0%)

Total Size: 72.9 kB

Filename Size Change
posthog-node/lib/index.cjs.js 19.8 kB +39 B (0%)
posthog-node/lib/index.esm.js 19.7 kB +40 B (0%)
posthog-web/lib/index.cjs.js 16.7 kB +21 B (0%)
posthog-web/lib/index.esm.js 16.7 kB +21 B (0%)

compressed-size-action

marandaneto commented 7 months ago

Missing changelog for https://github.com/PostHog/posthog-js-lite/blob/main/posthog-web/CHANGELOG.md

neilkakkar commented 7 months ago

thanks, added!