Skip to content

Commit

Permalink
Fix wrong file path in headers.md (remix-run#9228)
Browse files Browse the repository at this point in the history
  • Loading branch information
uerkw authored Apr 15, 2024
1 parent 6edd562 commit 3e947ec
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions contributors.yml
Original file line number Diff line number Diff line change
Expand Up @@ -621,6 +621,7 @@
- twhitbeck
- tylerbrostrom
- udasitharani
- uerkw
- uhoh-itsmaciek
- unhackit
- UsamaHameed
Expand Down
2 changes: 1 addition & 1 deletion docs/route/headers.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ If a user is looking at `/users/123/profile` and `users.$userId.profile.tsx` doe

If all three define `headers`, the deepest module wins, in this case `users.$userId.profile.tsx`. However, if your `users.$userId.profile.tsx`'s `loader` threw and bubbled to a boundary in `users.userId.tsx` - then `users.userId.tsx`'s `headers` function would be used as it is the leaf rendered route.

We don't want surprise headers in your responses, so it's your job to merge them if you'd like. Remix passes in the `parentHeaders` to your `headers` function. So `users.$userId.users.tsx` headers get passed to `users.$userId.tsx`, and then `users.$userId.tsx`'s `headers` are passed to `users.$userId.profile.tsx`'s `headers`.
We don't want surprise headers in your responses, so it's your job to merge them if you'd like. Remix passes in the `parentHeaders` to your `headers` function. So `users.tsx` headers get passed to `users.$userId.tsx`, and then `users.$userId.tsx`'s `headers` are passed to `users.$userId.profile.tsx`'s `headers`.

That is all to say that Remix has given you a very large gun with which to shoot your foot. You need to be careful not to send a `Cache-Control` from a child route module that is more aggressive than a parent route. Here's some code that picks the least aggressive caching in these cases:

Expand Down

0 comments on commit 3e947ec

Please sign in to comment.