Skip to content

Fix query infrastructure regressions breaking observable queries#2085

Merged
einari merged 3 commits into
mainfrom
fix/query-infrastructure-regressions
Apr 10, 2026
Merged

Fix query infrastructure regressions breaking observable queries#2085
einari merged 3 commits into
mainfrom
fix/query-infrastructure-regressions

Conversation

@einari
Copy link
Copy Markdown
Contributor

@einari einari commented Apr 10, 2026

Fixed

  • Fix subscriber disconnect completing shared observable subjects in the hub demultiplexer — after the first client disconnected, all subsequent hub subscriptions failed with Sequence contains no elements
  • Fix HubMessageType TypeScript enum using integer values instead of strings, causing all inbound hub message type comparisons to fail silently
  • Fix QueryResult and QueryResultWithState replacing null/undefined data with empty objects/arrays, causing hasData to return true when there was no data

einari added 3 commits April 10, 2026 13:16
…b demultiplexer

Calling subject.OnCompleted() when a hub subscriber's Rx subscription is
disposed permanently terminates the shared BehaviorSubject. Any subsequent
subscriber on the same query then receives the completed signal and observes
no elements, causing Observable.FirstAsync() to throw
'Sequence contains no elements'.

Remove the OnCompleted() call from the dispose action so that the shared
subject lives independently of individual client connections — matching the
existing pattern in ClientObservable.
The backend serializes ObservableQueryHubMessageType as strings via
JsonStringEnumConverter, but the TypeScript HubMessageType enum used
integer values (0-7). This caused all inbound type comparisons to fail
on the client, so hub subscriptions never delivered results.

Update the enum to match the string values emitted by the server.
…ty objects

Non-enumerable no-data fallback was changed from null to {}, and the ??
guards in QueryResultWithState.empty/initial/fromQueryResult were replacing
null/undefined defaultValues with []. Both caused hasData to return true
when there was no data, breaking the null-check contract.

Restore the original behaviour: pass values through without substitution
and let null/undefined propagate so hasData reflects true absence of data.

Update specs to assert the corrected contracts.
@einari einari added the patch label Apr 10, 2026
@einari einari merged commit 854de79 into main Apr 10, 2026
7 checks passed
@einari einari deleted the fix/query-infrastructure-regressions branch April 10, 2026 11:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant