Skip to content

Commit

Permalink
chore(release) 0.5.0
Browse files Browse the repository at this point in the history
  • Loading branch information
darrenjennings committed Jun 20, 2020
1 parent 43ba49e commit 55e765d
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
16 changes: 15 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ const { data, error, isValidating, revalidate } = useSWRV(key, fetcher, options)
| Param | Required | Description |
| --------- | -------- | ----------------------------------------------------------------------------------- |
| `key` | yes | a unique key string for the request (or a function / array / null) (advanced usage) |
| `fetcher` | yes | a Promise returning function to fetch your data (details) |
| `fetcher` | | a Promise returning function to fetch your data (details) |
| `options` | | an object of configuration options |

### Return Values
Expand Down Expand Up @@ -376,6 +376,20 @@ export default {
}
```

### Serve from Cache only

To only retrieve a swrv cache response without revalidating, you can omit the fetcher function from the useSWRV call.
This can be useful when there is some higher level swrv composable that is always sending data to other instances, so
you can assume that fetcher-less composables will have data available.

```ts
// Component A
const { data } = useSWRV('/api/config', fetcher)

// Component B, only retrieve from cache
const { data } = useSWRV('/api/config')
```

## Error Handling

Since `error` is returned as a Vue Ref, you can use watchers to handle any
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "swrv",
"version": "0.4.0",
"version": "0.5.0",
"main": "./dist/index.js",
"module": "./esm/index.js",
"scripts": {
Expand Down

0 comments on commit 55e765d

Please sign in to comment.