|
1 | 1 | import {useEffect, useRef} from 'react'; |
2 | 2 | import type {OnyxEntry} from 'react-native-onyx'; |
3 | 3 | import {clearAgentZeroProcessingIndicator} from '@libs/actions/Report'; |
4 | | -import {applyPendingConciergeAction, clearPendingFollowupList, discardPendingConciergeAction} from '@libs/actions/Report/SuggestedFollowup'; |
| 4 | +import {applyPendingConciergeAction, clearPendingFollowupList, discardPendingConciergeAction, hidePendingFollowupList} from '@libs/actions/Report/SuggestedFollowup'; |
5 | 5 | import {MAX_AGE_MS} from '@libs/AgentZeroOptimisticStore'; |
6 | 6 | import Log from '@libs/Log'; |
7 | 7 | import {rand64} from '@libs/NumberUtils'; |
@@ -86,10 +86,18 @@ function usePendingConciergeResponse(reportID: string | undefined) { |
86 | 86 | wasOfflineRef.current = isOffline; |
87 | 87 | }, [isOffline]); |
88 | 88 |
|
| 89 | + // Hide the followup-list skeleton when the user is offline. |
| 90 | + useEffect(() => { |
| 91 | + if (!reportID || !pendingFollowupList || !!pendingFollowupList.hidden === isOffline) { |
| 92 | + return; |
| 93 | + } |
| 94 | + hidePendingFollowupList(reportID, isOffline || null); |
| 95 | + }, [reportID, isOffline, pendingFollowupList]); |
| 96 | + |
89 | 97 | // Clear the pending followup-list skeleton flag as soon as the server reply |
90 | | - // (with <followup-list>) overwrites the optimistic action. A TTL fallback |
91 | | - // guards against the case where no followup-list ever arrives so the skeleton |
92 | | - // won't get stuck. |
| 98 | + // (with <followup-list>) overwrites the optimistic action. |
| 99 | + // A TTL fallback guards against the case where no followup-list ever arrives |
| 100 | + // so the skeleton won't get stuck. |
93 | 101 | useEffect(() => { |
94 | 102 | if (!reportID || !pendingFollowupList) { |
95 | 103 | return; |
|
0 commit comments