Uploaded image for project: 'Realm JavaScript SDK'
  1. Realm JavaScript SDK
  2. RJS-2173

Create Polyfill Convenience Modules

    • Type: Icon: Improvement Improvement
    • Resolution: Unresolved
    • Priority: Icon: Minor - P4 Minor - P4
    • None
    • Affects Version/s: None
    • Component/s: None

      Problem

      In order for React Native developers to use the MongoDB watch method, they are required to perform the following setup to their project:

      // Install the following dependencies
      npm install react-native-polyfill-globals text-encoding;
      
      // Add the following lines to index.js
      import { polyfill as polyfillReadableStream } from "react-native-polyfill-globals/src/readable-stream";
      polyfillReadableStream();
      
      import { polyfill as polyfillEncoding } from "react-native-polyfill-globals/src/encoding";
      polyfillEncoding();
      
      import { polyfill as polyfillFetch } from "react-native-polyfill-globals/src/fetch";
      polyfillFetch();
      

      Solution

      Add react-native-polyfill-globals and text-encoding as optional dependencies to Realm.
      Throw a warning when they are not present when trying to use the mongodb watch method.
      Give instructions on how to setup.
      Make the setup as easy as:

      import "realm/polyfills/react-native/watch";
      

      Alternatives

      Just document this better and have the developer do the heavy lifting.

      How important is this improvement for you?

      Would be a major improvement

      Feature would mainly be used with

      Atlas App Services: Auth or Functions etc

            Assignee:
            Unassigned Unassigned
            Reporter:
            andrew.meyer@mongodb.com Andrew Meyer
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: