We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
headers
actionHeaders
1 parent 733fd78 commit 0a814e6Copy full SHA for 0a814e6
contributors.yml
@@ -66,6 +66,7 @@
66
- bvangraafeiland
67
- camthompson
68
- CanRau
69
+- caprolactam
70
- cassidoo
71
- chaance
72
- chasinhues
docs/how-to/headers.md
@@ -55,11 +55,15 @@ export async function loader({ params }: LoaderArgs) {
55
Headers from loaders and actions are not sent automatically. You must explicitly return them from the `headers` export.
56
57
```tsx
58
+function hasAnyHeaders(headers: Headers): boolean {
59
+ return [...headers].length > 0;
60
+}
61
+
62
export function headers({
63
actionHeaders,
64
loaderHeaders,
65
}: HeadersArgs) {
- return actionHeaders ? actionHeaders : loaderHeaders;
+ return hasAnyHeaders(actionHeaders) ? actionHeaders : loaderHeaders;
}
```
0 commit comments