FORGE-2185: react-ditto v5 migration follow-ups#99
Merged
Aaron Leopold (aaronleopold) merged 3 commits intoJul 6, 2026
Conversation
- useQuery: add optional subscriptionQuery param, and stop a failed subscription registration from overwriting the hook error state so a healthy observer is not masked (v5 DQL_RESTRICT_SUBSCRIPTION rejects ORDER BY/LIMIT/OFFSET in subscriptions) - remove the trivially-passing "fails to load wasm" provider tests: init() is a process-global singleton so a bad wasm path is never exercised after the first init, and provider error-surfacing is already covered by the setup-failure tests - README: document the useRemotePeers/useConnectionStatus presence hooks and the v5 subscription constraint
Post-review cleanup: document that error reflects only observer setup (not subscription registration), and extract a reportError helper so the observer (setError + report) vs subscription (report only) failure semantics are legible.
Addresses PR review: after cancelling on reset, null both refs before re-registering so a failed (or skipped) registration no longer exposes a stale, already-cancelled observer/subscription on the return value. Covers the subscription-rejected, observer-rejected, and localOnly-toggle cases. Adds a test that resets into a rejected subscription query.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-ups from the FORGE-1921 v5 migration review. FORGE-2185
useQuerysubscriptions under v5v5 enables
DQL_RESTRICT_SUBSCRIPTION, soregisterSubscriptionrejectsORDER BY/LIMIT/OFFSET. SinceuseQuerysubscribed with the same query it observed, such a query left the hook in an error state with no subscription while the observer kept returning local-only data.subscriptionQueryparam so callers can subscribe with a sync-appropriate query (ignored whenlocalOnly).error; it surfaces viaonError/console.errorinstead, so a healthy observer isn't masked.Removed the "fails to load wasm" provider tests
Both asserted the error element was empty, so they passed trivially.
init()in v5 is a process-global singleton, so a bad wasm path is never exercised after the first init and can't be tested here. The provider's error-surfacing is already covered by the setup-failure tests, so these were removed rather than rewritten.README
Documented the
useRemotePeers/useConnectionStatuspresence hooks and the v5 subscription constraint