medusajs / medusa

The world's most flexible commerce platform.
https://medusajs.com
MIT License
25.86k stars 2.59k forks source link

TypeError: Cannot read property 'setItem' of undefined #6832

Closed n3cr0murl0c closed 4 months ago

n3cr0murl0c commented 7 months ago

Bug report

This error is located at: in tr (at Home.tsx:88) in RCTView (at View.js:116) in View (at ScrollView.js:1732) in RCTScrollView (at ScrollView.js:1855) in ScrollView (at ScrollView.js:1925) in ScrollView (at Home.tsx:74) in RCTView (at View.js:116) in View (at Home.tsx:65) in Home (at App.js:47) in StaticContainer in EnsureSingleNavigator (at SceneView.tsx:124) in SceneView (at useDescriptors.tsx:218) in RCTView (at View.js:116) in View (at DebugContainer.native.tsx:34) in DebugContainer (at NativeStackView.native.tsx:82) in MaybeNestedStack (at NativeStackView.native.tsx:325) in RCTView (at View.js:116) in View (at NativeStackView.native.tsx:318) in RNSScreen (at createAnimatedComponent.js:54) in Unknown (at src/index.native.tsx:314) in Suspender (at src/index.tsx:27) in Suspense (at src/index.tsx:26) in Freeze (at src/index.native.tsx:206) in DelayedFreeze (at src/index.native.tsx:313) in InnerScreen (at src/index.native.tsx:566) in Screen (at NativeStackView.native.tsx:253) in SceneView (at NativeStackView.native.tsx:413) in Suspender (at src/index.tsx:27) in Suspense (at src/index.tsx:26) in Freeze (at src/index.native.tsx:206) in DelayedFreeze (at src/index.native.tsx:220) in RNSScreenStack (at src/index.native.tsx:227) in ScreenStack (at NativeStackView.native.tsx:401) in NativeStackViewInner (at NativeStackView.native.tsx:474) in RNCSafeAreaProvider (at SafeAreaContext.tsx:92) in SafeAreaProvider (at SafeAreaProviderCompat.tsx:55) in SafeAreaProviderCompat (at NativeStackView.native.tsx:473) in NativeStackView (at createNativeStackNavigator.tsx:72) in PreventRemoveProvider (at useNavigationBuilder.tsx:718) in NavigationContent (at useComponent.tsx:35) in Unknown (at createNativeStackNavigator.tsx:71) in NativeStackNavigator (at App.js:45) in EnsureSingleNavigator (at BaseNavigationContainer.tsx:433) in BaseNavigationContainer (at NavigationContainer.tsx:132) in ThemeProvider (at NavigationContainer.tsx:131) in NavigationContainerInner (at App.js:44) in uo (at App.js:41) in ThemeProvider (at styleProvider.component.js:19) in MappingProvider (at styleProvider.component.js:18) in StyleProvider (at applicationProvider.component.js:93) in ApplicationProvider (at App.js:40) in QueryClientProvider (created by Bs) in Bs (at App.js:39) in App (at withDevTools.js:18) in withDevTools(App) (at renderApplication.js:57) in RCTView (at View.js:116) in View (at AppContainer.js:127) in RCTView (at View.js:116) in View (at AppContainer.js:155) in AppContainer (at renderApplication.js:50) in main(RootComponent) (at renderApplication.js:67), js engine: hermes

Describe the bug

After adding sessionCartProvider from https://docs.medusajs.com/references/medusa-react/providers/session_cart, app wont compile. it calls for setItem method (i've assume from AsyncStorage) but react-native dropped it and its now handled by the community so idk it has anything to do with it. After removing the provider apps works without problem. Home is surrounded with : from ui.kitten <MedusaProvider queryClientProviderProps={{ client: queryClient }} baseUrl={BASE_URL}> from medusa <ApplicationProvider {...eva} theme={eva.light}> from ui.kitten

from medusa from @react-navigation/native from @react-navigation/native-stack ### System information "dependencies": { "@eva-design/eva": "^2.2.0", "@medusajs/medusa-js": "^6.1.7", "@react-native-async-storage/async-storage": "1.21.0", "@react-navigation/native": "^6.1.17", "@react-navigation/native-stack": "^6.9.26", "@types/react": "~18.2.45", "@ui-kitten/components": "^5.3.1", "@ui-kitten/eva-icons": "^5.3.1", "axios": "^1.6.8", "expo": "~50.0.8", "expo-location": "~16.5.5", "expo-status-bar": "~1.11.1", "medusa-react": "^9.0.15", "react": "18.2.0", "react-native": "^0.73.4", "react-native-get-random-values": "~1.8.0", "react-native-image-slider-show": "^1.0.3", "react-native-paper": "^5.12.3", "react-native-safe-area-context": "4.8.2", "react-native-screens": "~3.29.0", "react-native-storage": "^1.0.1", "react-native-svg": "14.1.0", "react-native-webview": "13.6.4", "typescript": "^5.3.0" } Node.js version: 21.7.1 Database: postresql Operating system: linux kernel 6.5.1 ### Steps to reproduce the behavior 1. Add SessionCartProvider to your code on top a react-native expo app 2. reload app 3. won't compile 4. See error ### Expected behavior Being able to use the context ### Screenshots ### Code snippets `<> {/* */} {(props) => } {(props) => } {(props) => } {/* */} ` ### Additional context using medusa-adming as backend, and using medusa-react to handle backend operations from react-native app.
sradevski commented 4 months ago

Hey, thanks for the report! Since v2 brought a lot of architectural and API changes on the backend, we will be closing this ticket since it no longer applies to our new setup, or the issue has already been fixed. If you are still facing issues with v1, please open a new ticket and we will address it as soon as possible. Thanks! 🙏