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

`initialSubscription` should also provide `user` to its callback

    • Type: Icon: Improvement Improvement
    • Resolution: Unresolved
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: Realm React
    • Labels:

      When using the initialSubscription configuration for realm, it is very likely that the current user will be used to filter the flexible sync data. It would be great if the currentUser was also provided in the callback. Otherwise, an underlying component will have to setup the subscription to filter on user data.
      Ideal scenario:

      Unable to find source-code formatter for language: typescript. Available languages are: actionscript, ada, applescript, bash, c, c#, c++, cpp, css, erlang, go, groovy, haskell, html, java, javascript, js, json, lua, none, nyan, objc, perl, php, python, r, rainbow, ruby, scala, sh, sql, swift, visualbasic, xml, yaml
       <RealmProvider
              sync={{
                flexible: true,
                initialSubscriptions: {
                  update: (subs, realm, user) => {
                    // subscribe to all of the logged in user's to-do items
                    subs.add(realm.objects('Item').filtered(`owner_id == ${user.id}`), {name: 'ownItems'});
                  },
                },
              }}/>
      

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

              Created:
              Updated: