Skip to content

feat: add explicit terminal state to search snapshot #96061

Description

@mountiny

Problem

Whether a search snapshot has finished loading is inferred from a mix of fields (data, isLoading, type/status), which breaks when a request resolves with HTTP 200 but writes no data at all — nothing marks the snapshot as done, leaving the page stuck in a loading state. Search requests are read commands that never enter the offline queue, so the snapshot must own its own lifecycle.

Solution

Add an explicit state field (loading / loaded / error) to the search snapshot. getOnyxLoadingData writes loading optimistically on request start, a new successData branch writes loaded on any successful resolve (even without snapshot data), and failureData writes error. finallyData intentionally leaves state alone to avoid overwriting the error result. Network-level rejections apply failureData in a .catch() handler. This PR is write-side only; UI gates will migrate in a follow-up.

PR

#96043

Issue OwnerCurrent Issue Owner: @BartekObudzinski

Metadata

Metadata

Labels

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions