appwrite / sdk-for-web

[READ-ONLY] Official Appwrite Web SDK ๐Ÿงก
https://appwrite.io
BSD 3-Clause "New" or "Revised" License
273 stars 59 forks source link

๐Ÿ› Bug Report: Expo React Native realtime URLSearchParams.set is not implemented #47

Closed anhtuank7c closed 1 year ago

anhtuank7c commented 1 year ago

๐Ÿ‘Ÿ Reproduction steps

I'm trying to subscribe to a document on the Expo client.

// expo project
import { Client } from 'appwrite';
const client = new Client().setProject(PROJECT_ID).setEndpoint(ENDPOINT_HERE);

useEffect(
    function subscribeToLikeAndCommentCount() {
      const unsubscribe = client.subscribe(
        `databases.DATABASE_ID_HERE.collections.COLLECTION_ID_HERE.documents.${videoId}`,
        (payload) => {
          console.log('payload', payload);
        }
      );
      return () => unsubscribe();
    },
    [videoId]
  );

I'm trying to install polyfill manually but got another issue with localstorage that doesn't exist on React Native. https://github.com/facebook/react-native/issues/23922#issuecomment-648096619 Simulator Screen Shot - iPhone 14 Pro - 2022-12-31 at 17 47 04 Simulator Screen Shot - iPhone 14 Pro - 2022-12-31 at 17 42 51 Screenshot 2022-12-31 at 17 47 23

๐Ÿ‘ Expected behavior

should print the console logs for the payload

๐Ÿ‘Ž Actual Behavior

Error: URLSearchParams.set is not implemented

๐ŸŽฒ Appwrite version

Version 0.10.x

๐Ÿ’ป Operating system

MacOS

๐Ÿงฑ Your Environment

System:
    OS: macOS 13.1
    CPU: (8) x64 Apple M1
    Memory: 37.08 MB / 16.00 GB
    Shell: 5.8.1 - /bin/zsh
  Binaries:
    Node: 18.7.0 - /usr/local/bin/node
    Yarn: 1.22.19 - ~/.nvm/versions/node/v18.7.0/bin/yarn
    npm: 8.15.0 - ~/.nvm/versions/node/v18.7.0/bin/npm
    Watchman: 2022.10.03.00 - /opt/homebrew/bin/watchman
  Managers:
    CocoaPods: 1.11.3 - /Users/tuannguyen/.rvm/gems/ruby-2.7.5/bin/pod
  SDKs:
    iOS SDK:
      Platforms: DriverKit 22.2, iOS 16.2, macOS 13.1, tvOS 16.1, watchOS 9.1
    Android SDK:
      API Levels: 29, 31, 32, 33
      Build Tools: 30.0.3, 31.0.0, 32.0.0, 32.1.0, 33.0.0
      System Images: android-32 | Google APIs ARM 64 v8a, android-33 | Google Play ARM 64 v8a
      Android NDK: Not Found
  IDEs:
    Android Studio: 2021.3 AI-213.7172.25.2113.9123335
    Xcode: 14.2/14C18 - /usr/bin/xcodebuild
  Languages:
    Java: 11.0.11 - /usr/bin/javac
  npmPackages:
    @react-native-community/cli: Not Found
    react: 18.1.0 => 18.1.0 
    react-native: 0.70.5 => 0.70.5 
    expo: 47.0.0
    react-native-macos: Not Found
  npmGlobalPackages:
    *react-native*: Not Found

๐Ÿ‘€ Have you spent some time to check if this issue has been raised before?

๐Ÿข Have you read the Code of Conduct?

stnguyen90 commented 1 year ago

Is the local storage error the same as https://github.com/appwrite/sdk-for-web/issues/29? Can you ๐Ÿ‘ that issue and close this as a duplicate?

anhtuank7c commented 1 year ago

@stnguyen90 If I fix the Polyfill issue, yes, it become the same as #29 But I think we should keep this issue open for the Polyfill issue. What do you think?

stnguyen90 commented 1 year ago

But I think we should keep this issue open for the Polyfill issue.

From what I understand, React Native requires a polyfill. Is that right? What are you suggesting?

anhtuank7c commented 1 year ago

@stnguyen90 Yeah, I would suggest installing this one: https://github.com/expo/browser-polyfill for react native.

Can we somehow make local storage to be flexible to configs such as AsyncStorage or MMKV

stnguyen90 commented 1 year ago

@anhtuank7c,

Yeah, I would suggest installing this one: https://github.com/expo/browser-polyfill for react native.

That seems out of the scope of Appwrite, then, right? As such, can this be closed?

Can we somehow make local storage to be flexible to configs such as AsyncStorage or MMKV

You might want to open a separate issue to request that.

anhtuank7c commented 1 year ago

Thank you for update. I've replaced Appwrite completely by PocketBase. Issue no longer needed.