realm-js icon indicating copy to clipboard operation
realm-js copied to clipboard

Throw an error if you try to call `realm.subscriptions.update` inside an `initialSubscriptions` `update` call

Open tomduncalf opened this issue 2 years ago • 2 comments

Right now calling realm.subscriptions.update inside an initialSubscriptions update callback results in a cryptic error, because the code is already running inside a subscription update transaction. Users should use the first subs argument passed to the update callback instead to directly mutate the subscription set.

This is documented but it could be confusing, so it may be worth throwing a clearer error if we can detect that a user is doing this.

tomduncalf avatar Jun 29 '22 09:06 tomduncalf

We should probably consider this a breaking change if the current behavior is documented and people may rely on how it works.

fronck avatar Jul 01 '22 12:07 fronck

We are planning to rethink the Flexible Sync API, and I don't see we need to investigate further on this issue until then.

kneth avatar Sep 16 '22 09:09 kneth