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

Problem creating UserSession in Expo/React Native app #1783

Open
dacosta-dev opened this issue Jan 21, 2025 · 1 comment
Open

Problem creating UserSession in Expo/React Native app #1783

dacosta-dev opened this issue Jan 21, 2025 · 1 comment
Labels
bug Unwanted or unintended logic causing harm

Comments

@dacosta-dev
Copy link

dacosta-dev commented Jan 21, 2025

What version of Stacks.js are you using?

@stacks/auth: 7.0.2

Describe the bug

When a new instance of the UserSession class is trying to be created, in an Expo environment and without a valid second parameter for a sessionStore, the code in the constructor assumes that it is running in the browser and defaults to create an instance of LocalStorageStore rather than InstanceDataStore which leads to an error.

The class InstanceDataStore is not provided by the library

How to reproduce

import { AppConfig, UserSession } from '@stacks/auth';

const appConfig = new AppConfig(['store_write']);
const userSession = new UserSession({ appConfig });

Expected behavior

Code should correctly detect the mobile environment and/or perhaps provide access to InstanceDataStore

Additional context

  • Desktop/Smartphone OS: Android 15

https://github.com/hirosystems/stacks.js/blob/main/packages/auth/src/userSession.ts#L60

@dacosta-dev dacosta-dev added the bug Unwanted or unintended logic causing harm label Jan 21, 2025
@github-project-automation github-project-automation bot moved this to 🆕 New in DevTools Jan 21, 2025
@dacosta-dev
Copy link
Author

I am interested in helping with the issues

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Unwanted or unintended logic causing harm
Projects
Status: 🆕 New
Development

No branches or pull requests

1 participant