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

feat: add staleIfError option for request.cacheControl, also adds docs on caching and caching to starters #4313

Merged
merged 8 commits into from
May 24, 2023

Conversation

steve8708
Copy link
Contributor

@steve8708 steve8708 commented May 23, 2023

Overview

What is it?

  • Feature / enhancement
  • Bug
  • Docs / tests / types / typos

Description

This is a really useful cache-control directive to avoid unnecessary downtime - allowing the CDN to serve stale responses when your origin is down

Also added a doc on caching, and added default caching to our starters

Checklist:

  • My code follows the developer guidelines of this project
  • I have performed a self-review of my own code
  • I have made corresponding changes to the documentation
  • Added new tests to cover the fix / functionality

@stackblitz
Copy link

stackblitz bot commented May 23, 2023

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

@steve8708 steve8708 changed the title feat: add staleIfError option for request.cacheControl feat: add staleIfError option for request.cacheControl, also adds docs on caching May 23, 2023
@steve8708
Copy link
Contributor Author

also added some caching default to our starters with links to docs

@steve8708 steve8708 changed the title feat: add staleIfError option for request.cacheControl, also adds docs on caching feat: add staleIfError option for request.cacheControl, also adds docs on caching and caching to starters May 23, 2023
@zanettin zanettin added the COMP: docs Improvements or additions to documentation label May 23, 2023
```tsx title="src/routes/layout.tsx"
import type { RequestHandler } from "@builder.io/qwik-city";

export const onGet: RequestHandler = async (request) => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think use the destructured version of this, like

async ({ cacheControl }) =>

Technically the object is a RequestEvent, so I think naming it just a request and setting response caching may be confusing in the docs.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah cool easy, on it

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated ✅

@adamdbradley adamdbradley merged commit f754c45 into QwikDev:main May 24, 2023
19 checks passed
@renovate renovate bot mentioned this pull request Aug 3, 2023
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
COMP: docs Improvements or additions to documentation COMP: qwik-city
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants