swr
swr copied to clipboard
Type error when fallback option with undefined.
Bug report
Description / Observed Behavior
An error will occur if the fallback option for useSWR is undefined.
const { data, error } = useSWR("/api/hello", {
fallback: undefined
});
fallback option can be specified as undefined in the type definition. The above code causes the following error.
TypeError: Cannot read properties of undefined (reading '/api/hello')
Expected Behavior
I think fallback option should check if it is undefined. (For example, here)
Repro Steps / Code Example
Additional Context
SWR version. 2.2.5 Add any other context about the problem here.