getShouldClearState
Determines whether state should be cleared when the cache key changes.
"clean"
— always clear
"preserve"
— never clear
"auto"
— clear when the resource identity changed (URL params), preserve when only query params changed
In the "auto" mode the identity is read from the cache keys, which is not reliable for custom cache keys
and for query params containing underscores - compare the requests with
getRequestIdentity
when they are available.
Import
import { getShouldClearState } from "@hyper-fetch/react"
Source
Package
Parameters
getShouldClearState(mode: auto | preserve | clean, oldCacheKey: string, newCacheKey: string)
Parameters
| Name | Type | Description |
|---|---|---|
| mode | | |
| oldCacheKey | | |
| newCacheKey | |
Returns
boolean
