epic-stack icon indicating copy to clipboard operation
epic-stack copied to clipboard

add util for handling remix headers generally

Open nichtsam opened this issue 1 year ago • 1 comments

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

  • There are test cases for various functionalities.
  • Test cases with real use cases ensure the utility remains practical.

Checklist

  • [x] Tests updated
  • [x] Docs updated

nichtsam avatar Aug 03 '24 14:08 nichtsam

Just for the record, reason for switching to draft: https://github.com/privatenumber/tsx/issues/627 This is affecting vite and causing imports behavior to differentiate between tsx and node.

nichtsam avatar Aug 03 '24 14:08 nichtsam

Just for the record, reason for switching to draft: privatenumber/tsx#627 This is affecting vite and causing imports behavior to differentiate between tsx and node.

I switch to another ESM cache-control parser to avoid encountering this issue.

nichtsam avatar Dec 04 '24 17:12 nichtsam

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!

kentcdodds avatar Dec 06 '24 15:12 kentcdodds

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. Just wanted to finish up the PR. No worries, and thanks for the update!

nichtsam avatar Dec 07 '24 08:12 nichtsam

RR7 has been merged! Feel free to check whether this is necessary and update things if so. Thanks!

kentcdodds avatar Jan 16 '25 00:01 kentcdodds

RR7 has been merged! Feel free to check whether this is necessary and update things if so. Thanks!

I've rebased onto main. I’ve tested the behavior of headers, and it appears to remain unchanged, where:

  • Either loaderHeaders or actionHeaders will have a value, but not both at the same time.
  • errorHeaders will be present when an error occurs and will mirror the value of either loaderHeaders or actionHeaders.

nichtsam avatar Jan 16 '25 12:01 nichtsam