Skip to content

perf: disable cacheImmutable by default#39

Merged
chenjiahan merged 1 commit intomainfrom
disable_immutable_0415
Apr 15, 2026
Merged

perf: disable cacheImmutable by default#39
chenjiahan merged 1 commit intomainfrom
disable_immutable_0415

Conversation

@chenjiahan
Copy link
Copy Markdown
Member

Disable cacheImmutable by default to reduce the perf overhead of getAsset().

#38

Copilot AI review requested due to automatic review settings April 15, 2026 05:38
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Disables cacheImmutable by default so immutable assets no longer automatically receive Cache-Control: ..., immutable unless explicitly opted in, reducing overhead on the request path.

Changes:

  • Change middleware cache header behavior to only apply immutable caching when cacheImmutable === true.
  • Update docs and type definitions to reflect the new default (false when omitted).
  • Adjust middleware tests to explicitly set cacheImmutable: true where the immutable behavior is expected.

Reviewed changes

Copilot reviewed 4 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/middleware.js Changes immutable cache decision logic to require an explicit cacheImmutable: true.
test/middleware.test.js Updates tests to opt into immutable caching explicitly and updates expectations for the new default.
README.md Documents the new cacheImmutable default and updated semantics.
src/index.js Updates JSDoc option docs for cacheImmutable default.
types/index.d.ts Updates type docs/comments for cacheImmutable default.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread test/middleware.test.js
@chenjiahan chenjiahan merged commit 247c26c into main Apr 15, 2026
9 checks passed
@chenjiahan chenjiahan deleted the disable_immutable_0415 branch April 15, 2026 05:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants