Skip to content

feat: expose HeadersArgs & HeadersFunctionArgs type - #6247

Merged
brophdawg11 merged 7 commits into
devfrom
logan/headersfunctionargs
May 16, 2023
Merged

brophdawg11 merged 7 commits into
devfrom
logan/headersfunctionargs

Conversation

@mcansh

@mcansh mcansh commented Apr 29, 2023 •

Copy link
Copy Markdown
Contributor

add HeadersFunctionArgs (and HeadersArgs) type to be consistent with ActionArgs, LoaderArgs, DataFunctionArgs and allows for using function

import type { HeadersFunctionArgs } from '@remix-run/*';
export function headers({ loaderHeaders }: HeadersFunctionArgs) {
  return {
    "x-my-custom-thing": loaderHeaders.get("x-my-custom-thing") || "fallback"
  }
}

Closes: #

  • Docs
  • Tests

Testing Strategy:

@changeset-bot

changeset-bot Bot commented Apr 29, 2023 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 2d49c81

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 18 packages
Name Type
remix Patch
@remix-run/cloudflare Patch
@remix-run/deno Patch
@remix-run/dev Patch
@remix-run/eslint-config Patch
@remix-run/node Patch
@remix-run/serve Patch
@remix-run/server-runtime Patch
@remix-run/cloudflare-pages Patch
@remix-run/cloudflare-workers Patch
create-remix Patch
@remix-run/css-bundle Patch
@remix-run/architect Patch
@remix-run/express Patch
@remix-run/netlify Patch
@remix-run/testing Patch
@remix-run/vercel Patch
@remix-run/react Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@MichaelDeBoey MichaelDeBoey changed the title chore: add HeadersFunctionArgs type to be consistent with loaders/actions/meta feat: expose HeadersFunctionArgs type Apr 29, 2023
@MichaelDeBoey MichaelDeBoey changed the title feat: expose HeadersFunctionArgs type feat: expose HeadersArgs & HeadersFunctionArgs type Apr 29, 2023
Comment thread .changeset/headersfunctionargs.md Outdated
mcansh and others added 5 commits May 3, 2023 11:41
…ions/meta

Signed-off-by: Logan McAnsh <logan@mcan.sh>
Signed-off-by: Logan McAnsh <logan@mcan.sh>
Signed-off-by: Logan McAnsh <logan@mcan.sh>
Co-authored-by: Michaël De Boey <info@michaeldeboey.be>
@mcansh
mcansh force-pushed the logan/headersfunctionargs branch from 831b1fb to 9d79ca9 Compare May 3, 2023 15:41
@MichaelDeBoey
MichaelDeBoey requested a review from brophdawg11 May 7, 2023 03:16
@brophdawg11

Copy link
Copy Markdown
Contributor

To avoid having 2 aliases of the same thing, I removed HeadersFunctionArgs and we only have HeadersArgs to be consistent with LoaderArgs/ActionArgs. Personally I don't think DataFunctionArgs should have ever been exported since it's really an implementation detail.

The agnostic router uses LoaderFunctionArgs and ActionFunctionArgs so I don't think we need to leak that naming scheme out through Remix.

@brophdawg11
brophdawg11 merged commit f93d18a into dev May 16, 2023
@brophdawg11
brophdawg11 deleted the logan/headersfunctionargs branch May 16, 2023 16:45
@github-actions

Copy link
Copy Markdown
Contributor

🤖 Hello there,

We just published version v0.0.0-nightly-f93d18a-20230517 which includes this pull request. If you'd like to take it for a test run please try it out and let us know what you think!

Thanks!

@github-actions

Copy link
Copy Markdown
Contributor

🤖 Hello there,

We just published version v0.0.0-nightly-aa2e31b-20230518 which includes this pull request. If you'd like to take it for a test run please try it out and let us know what you think!

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants