mirror of
https://github.com/rowboatlabs/rowboat.git
synced 2026-06-12 19:55:19 +02:00
fix first load issue
This commit is contained in:
parent
d757dc37da
commit
10c65f097a
1 changed files with 5 additions and 2 deletions
|
|
@ -872,8 +872,10 @@ export function EmailView() {
|
|||
}, [selectedThreadId, reloadFirstPage])
|
||||
|
||||
// Live refresh: hit the Gmail API to validate the freshest threads, then re-render.
|
||||
const refreshInFlightRef = useRef(false)
|
||||
const refresh = useCallback(async () => {
|
||||
if (refreshing) return
|
||||
if (refreshInFlightRef.current) return
|
||||
refreshInFlightRef.current = true
|
||||
setRefreshing(true)
|
||||
setError(null)
|
||||
try {
|
||||
|
|
@ -896,9 +898,10 @@ export function EmailView() {
|
|||
console.warn('[Gmail] live refresh failed:', err)
|
||||
setError(err instanceof Error ? err.message : String(err))
|
||||
} finally {
|
||||
refreshInFlightRef.current = false
|
||||
setRefreshing(false)
|
||||
}
|
||||
}, [refreshing, reloadFirstPage])
|
||||
}, [reloadFirstPage])
|
||||
|
||||
// Kick off a live refresh on mount only when there's no persisted data —
|
||||
// otherwise we'd clobber the snapshot the user already had.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue