realm-js
realm-js copied to clipboard
Throw an error if you try to call `realm.subscriptions.update` inside an `initialSubscriptions` `update` call
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.
We should probably consider this a breaking change if the current behavior is documented and people may rely on how it works.
We are planning to rethink the Flexible Sync API, and I don't see we need to investigate further on this issue until then.