Skip to content

[4.0] Update ObservableQuery.getCurrentResult() to return the last emitted result #12480

Closed
@jerelmiller

Description

@jerelmiller

Currently ObservableQuery.getCurrentResult() returns a non-stable object when calling it multiple times. This is because it dynamically calculates the result, regardless of whether the value has actually been emitted or not (for example, its possible to get a loading state from getCurrentResult even when notifyOnNetworkStatusChange is false).

This makes it hostile to use in cases where you need a stable value. Furthermore it doesn't always reflect actual values emitted from the observable. We'd like to change this unpredictablility.

This change will also allow us to simplify our React hooks, such as useQuery, since it would allow us to use getCurrentResult with useSyncExternalStore without the need to track those state values externally.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions