()
| 115 | // view: the API credits it in a worker, so it can still be the |
| 116 | // pre-view streak. |
| 117 | const refetchStreak = async (): Promise<UserStreak | undefined> => { |
| 118 | await client.refetchQueries({ queryKey: streakKey }); |
| 119 | const refetched = client.getQueryData<UserStreak>(streakKey); |
| 120 | |
| 121 | return includesThisRead( |
| 122 | refetched, |
| 123 | user?.timezone, |
| 124 | optimisticStreak?.current ?? context.nextStreak, |
| 125 | ) |
| 126 | ? refetched |
| 127 | : undefined; |
| 128 | }; |
| 129 | let countedStreak = await refetchStreak(); |
| 130 | |
| 131 | // The worker may not have credited the view yet: keep the optimistic |
no test coverage detected