feat: resolve Search loading gates from snapshot terminal state#96388
Draft
BartekObudzinski wants to merge 1 commit into
Draft
feat: resolve Search loading gates from snapshot terminal state#96388BartekObudzinski wants to merge 1 commit into
BartekObudzinski wants to merge 1 commit into
Conversation
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.
Explanation of Change
The Search page decides whether to show its loading skeleton from the shape of the snapshot data (
data === undefined) and a storedsearch.isLoadingflag. Both can lie: a successful response that writes no snapshot data leavesdataundefined forever, and a reload or dropped response can strandisLoading, so the skeleton hangs indefinitely with no request running.This change moves the Search loading gates onto the snapshot's explicit terminal lifecycle state (
loading | loaded | error), which the search action always resolves on success, failure, or a network-level rejection:isSearchDataLoadedtreats a terminalloaded/errorstate as resolved, so a response that carried no data hands off to Search's own empty view instead of pinning the skeleton. The existing type/hash match still rejects a stale snapshot that Onyx can transiently return for the previous query.useSearchLoadingStatestops the page skeleton once the request resolves.isLoadingflag. It relies on resolved snapshot data plus the search action's existing in-flight de-duplication, which resets on reload, so a stranded loading state re-fires and self-heals instead of blocking forever.hash(alongsidetype) so a terminal state satisfies the anti-stale match even on a response that carried none of its own metadata.jsonCode200 with no snapshot data) now logs a diagnostic so this previously-invisible case stays queryable.Adds a helper
isSearchPending(searchResults)and unit tests for the terminal-state read side. Healthy paths are unchanged; the only behavior difference is that a resolved-but-dataless response now shows the empty view instead of an endless skeleton.Fixed Issues
$
PROPOSAL:
Tests
Offline tests
QA Steps
Same as tests.
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectionAvatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))npm run compress-svg)Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel and/or tagged@Expensify/designso the design team can review the changes.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Screenshots/Videos
Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari