-
Notifications
You must be signed in to change notification settings - Fork 420
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
add util for handling remix headers generally #810
add util for handling remix headers generally #810
Conversation
0d4fdfd
to
6c36dca
Compare
Just for the record, reason for switching to draft: privatenumber/tsx#627 |
f9f6ccf
to
6fae52e
Compare
I switch to another ESM cache-control parser to avoid encountering this issue. |
f8356fd
to
161d544
Compare
I think React Router v7 (single fetch specifically) changes how headers work a fair bit so I don't think I'll be merging this since I want to get on RR7 soon. Sorry I didn't get to you on this sooner! |
That’s totally fine! I was also thinking that single fetch might impact things. |
RR7 has been merged! Feel free to check whether this is necessary and update things if so. Thanks! |
88eaf17
to
bae3048
Compare
bae3048
to
f40e9b0
Compare
I've rebased onto main.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! Just two changes.
app/utils/remix.server.ts
Outdated
@@ -0,0 +1,103 @@ | |||
import { type CacheControlValue, parse, format } from '@tusbar/cache-control' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think calling this file remix.server.ts
may not be the right call anymore. Maybe this should just be called headers.server.ts
.
Also, could you add some jsdoc comments to these utilities? Thanks!
app/utils/remix.server.test.ts
Outdated
import { describe, expect, test } from 'vitest' | ||
import { getConservativeCacheControl } from './remix.server.ts' | ||
|
||
describe('getConservativeCacheControl', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I prefer to not use describe
because it's unnecessary. Just put the test blocks at the root of the file.
It's a bit tedious to manually merge Remix headers since the process is mostly the same.
This PR adds a utility to streamline that process.
Related Discussion #809
More details on the utility: https://gist.github.com/nichtsam/bff3a0e58f7edfad3985e9322582f67f
Test Plan
Checklist