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

Realm Web: Cancel watch requests gracefully

      Goals

      Cancelling a watch on collections should yield no errors.

      Expected Results

      It shouldn't be an error to cancel watching a collection.

      We might be more successful if we made the react-network-transport take a signal that can be used to cancel the underlying request instead of cancelling a stream locked to a reader actively reading.

      Actual Results

      In the current implementation of cancellation of the watch requests we're calling cancel on a ReadableStreamDefaultReader which will throw if the is awaiting the next change while cancelling. This results in an error logged in the console when closing the stream / connection which is unexpected.

      > net::ERR_FAILED 200

      Steps to Reproduce

      Watch a collection and call return on the AsyncIterator returned from the call after awaiting a read of the next change.

      Code Sample

      <!---
      Please provide a code sample or test case that highlights the issue.
      If relevant, include your model definitions.
      For larger code samples, links to external gists/repositories are preferred.
      Full projects that we can compile and run ourselves are ideal!
      -->

      Version of Realm and Tooling

      • Realm Web SDK Version: 1.3.0

            Assignee:
            kraen.hansen@mongodb.com Kræn Hansen
            Reporter:
            kraen.hansen@mongodb.com Kræn Hansen
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: