Skip to content

Commit

Permalink
Merge pull request #78 from HubSpot/bmatto/fix-data-fethcing-docs-on-…
Browse files Browse the repository at this point in the history
…caching

Update docs with correct caching config information
  • Loading branch information
bmatto committed Jul 18, 2024
2 parents 069b881 + 2044272 commit 8b6c76e
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions docs/reference/data-fetching.md
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ Cache "keys" are based on the following:

Knowing this, if you hadn't made changes to any data flowing into the module, but still wanted to bust the cache, a new project build would suffice.

The `cacheConfig` property that is returned from `getServerSideProps` currently has one property `cacheControl`. This represents the `Cache-Control` header, and the properties can be any of the standard directives.
The `caching` property that is returned from `getServerSideProps` currently has one property `cacheControl`. This represents the `Cache-Control` header, and the properties can be any of the standard directives.

```typescript
import { withModuleProps } from 'path/to/helpers';
Expand All @@ -160,12 +160,12 @@ const fetchData = async (props: ModulePropsWithoutSSP) => {
const results = await fetch(...).then(response => response.json())

return {
serverSideProps {
results,
cacheConfig: {
cacheControl: {
maxAge 60
}
serverSideProps: {
results
},
caching: {
cacheControl: {
maxAge: 60
}
}
}
Expand Down

0 comments on commit 8b6c76e

Please sign in to comment.