PostHog / posthog-js-lite

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

fix: should attempt localstorage correctly before falling back to session storage #236

Closed haddowg closed 5 months ago

haddowg commented 5 months ago

Problem

Usage in the browser will always fallback to session storage rather than localstorage due to a simple logical conditional error. When local storage is available it should be used when requested before falling back to sessionstorage.

Changes

Corrects faulty condition so availability of local storage is evaluated correctly

Release info Sub-libraries affected

Bump level

Libraries affected

Changelog notes

marandaneto commented 5 months ago

@benjackwhite I think this is right but just double-checking since I don't know much about the so many storage options in the browser =D

marandaneto commented 5 months ago

@haddowg thanks for the PR Mind adding an entry to the changelog https://github.com/PostHog/posthog-js-lite/blob/main/posthog-web/CHANGELOG.md so we can merge and release that?

haddowg commented 5 months ago

@marandaneto hows that?