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

fix(cache): set cache item before returning response on first request #1813

Merged
merged 4 commits into from
Oct 19, 2023

Conversation

yassilah
Copy link
Contributor

πŸ”— Linked issue

fixes #1812

❓ Type of change

  • πŸ“– Documentation (updates to the documentation, readme, or JSdoc annotations)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • πŸ‘Œ Enhancement (improving an existing functionality like performance)
  • ✨ New feature (a non-breaking change that adds functionality)
  • 🧹 Chore (updates to the build process or auxiliary tools and libraries)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

πŸ“š Description

This PR fixes the linked issue; however, while writing my test I noticed there may be another issue with setting the integrity key in defineCachedEventHandler to an array of items as this will inevitably result in entry.integrity === integrity to be false... I changed it to be hash([opts.integrity, handler]) and all other tests still pass but there may be something I'm not seeing here πŸ˜…

πŸ“ Checklist

  • I have linked an issue or discussion.
  • I have updated the documentation accordingly.

@Hebilicious Hebilicious requested a review from pi0 October 10, 2023 22:44
src/runtime/cache.ts Outdated Show resolved Hide resolved
@pi0
Copy link
Member

pi0 commented Oct 11, 2023

Thanks for PR dear @yassilah. I will have to locally verify your reproduction from #1812. In the meantime, if there is another fix for integrity, feel free to split it into new PR for better changelog.

@yassilah
Copy link
Contributor Author

You're very welcome! You're right, i'll split it into 2 PRs 😊

@codecov
Copy link

codecov bot commented Oct 19, 2023

Codecov Report

Merging #1813 (63e4b24) into main (3e9302a) will decrease coverage by 0.01%.
The diff coverage is 0.00%.

@@            Coverage Diff             @@
##             main    #1813      +/-   ##
==========================================
- Coverage   52.36%   52.35%   -0.01%     
==========================================
  Files         170      170              
  Lines       11775    11777       +2     
  Branches      907      907              
==========================================
  Hits         6166     6166              
- Misses       5513     5515       +2     
  Partials       96       96              
Files Coverage Ξ”
src/runtime/cache.ts 0.00% <0.00%> (ΓΈ)

Copy link
Member

@pi0 pi0 left a comment

Choose a reason for hiding this comment

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

Thanks!

@pi0 pi0 merged commit bfe1eaa into unjs:main Oct 19, 2023
7 of 8 checks passed
@yassilah yassilah deleted the fix-awaited-cache branch October 19, 2023 11:34
@pi0 pi0 mentioned this pull request Oct 19, 2023
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.

Cache item is not set before returning response
2 participants