Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Fix comment and startAt type #1541

Merged
merged 1 commit into from
Oct 10, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/use-swr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,8 @@ export const useSWRHandler = <Data = any, Error = any>(
if (getConfig().isPaused()) return false

return suspense
? // Under suspense mode, we will have to revalidate if there's no stale
// data to return.
? // Under suspense mode, it will always fetch on render if there is no
// stale data so no need to revalidate immediately on mount again.
!isUndefined(data)
: // If there is no stale data, we need to revalidate on mount;
// If `revalidateIfStale` is set to true, we will always revalidate.
Expand Down Expand Up @@ -126,7 +126,7 @@ export const useSWRHandler = <Data = any, Error = any>(
}

let newData: Data
let startAt = -1
let startAt: number | undefined
huozhi marked this conversation as resolved.
Show resolved Hide resolved
let loading = true
const opts = revalidateOpts || {}

Expand All @@ -144,7 +144,7 @@ export const useSWRHandler = <Data = any, Error = any>(
key === keyRef.current &&
initialMountedRef.current

const cleanupState = (ts: number) => {
const cleanupState = (ts?: number) => {
// CONCURRENT_PROMISES_TS[key] might be overridden, check if it's still
// the same request before deleting.
if (CONCURRENT_PROMISES_TS[key] === ts) {
Expand Down