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

Return proper Response object in Pages function #149

Merged
merged 1 commit into from
Jan 24, 2025
Merged

Conversation

benvinegar
Copy link
Owner

When converting to React Router 7, while trying to address some TypeScript typing issues, I made the mistake of not returning a proper Response object in the /collect Pages handler.

This meant that /collect was 1) writing the data, but 2) returning a 500 afterwards, which likely led to a host of issues like not setting If-Modified-Since headers properly (refs #148). This bug didn't appear in tests, nor using the Vite development server, which I mostly use for local development.

This highlights how the Pages function handlers need to be covered by tests, but on the flip side, they're being removed on the v3 branch underway.

Copy link

codecov bot commented Jan 24, 2025

Codecov Report

Attention: Patch coverage is 0% with 1 line in your changes missing coverage. Please review.

Project coverage is 87.25%. Comparing base (7c28341) to head (b04f852).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
packages/server/functions/collect.ts 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #149      +/-   ##
==========================================
+ Coverage   87.00%   87.25%   +0.25%     
==========================================
  Files          38       38              
  Lines        2439     2432       -7     
  Branches      302      302              
==========================================
  Hits         2122     2122              
+ Misses        309      302       -7     
  Partials        8        8              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@benvinegar benvinegar merged commit e9c3a1f into main Jan 24, 2025
3 checks passed
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.

1 participant