Skip to content
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

If async-storage or expo-file-system is not installed, the SDK will fallback to persistence: memory and log a warning #146

Merged
merged 8 commits into from
Dec 21, 2023

Conversation

marandaneto
Copy link
Member

@marandaneto marandaneto commented Dec 21, 2023

Problem

If you install the PH SDK in a clean sample app and run yarn test, the test will fail because the PH SDK needs the storage libs but they aren't available for other targets than Android and iOS.
The only option is to mock the libs or set the persistence to memory, both are not great as a first experience when using our SDK so it's better to use a fallback instead of throwing an error and letting the user figure it out.

Fixes #143

Changes

SDK fallback to persistence: memory if storage libs aren't installed.
Added a test but it failed because of facebook/react-native#35701 so I removed it, I tested the code at runtime though.

Release info Sub-libraries affected

Bump level

  • Major
  • Minor
  • Patch

Libraries affected

  • All of them
  • posthog-web
  • posthog-node
  • posthog-react-native

Changelog notes

  • Added support for X

Copy link
Collaborator

@benjackwhite benjackwhite left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I really don't like this solution but I can't think of a better one so lets do it 😅

@marandaneto
Copy link
Member Author

I really don't like this solution but I can't think of a better one so lets do it 😅

Same 😅

@marandaneto marandaneto merged commit 7026e98 into main Dec 21, 2023
3 checks passed
@marandaneto marandaneto deleted the chore/no-storage-warning branch December 21, 2023 13:29
@marandaneto marandaneto mentioned this pull request Dec 21, 2023
7 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants