Skip to content

Commit

Permalink
Refactor browser APIs (#716)
Browse files Browse the repository at this point in the history
* Refactor browser APIs

* More cleanup

* Add more passthrough details on BrowserResponse

* More moves

* Add back more components

* More fixes

* Update some parts of templates

* More template and e2e test updates

* Fix some e2e tests

* Some react-server-render cleanup

* Remove rest of react-server-render

* Fix html/ body attributes

* Fix more tests

* Another test fix

* Add changeset

* Lints
  • Loading branch information
lemonmade committed May 5, 2024
1 parent c402a9a commit 7daafca
Show file tree
Hide file tree
Showing 244 changed files with 2,492 additions and 5,315 deletions.
16 changes: 16 additions & 0 deletions .changeset/silver-bananas-compare.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
'@quilted/react-query': patch
'@quilted/react-localize': patch
'@quilted/react-browser': patch
'@quilted/react-router': patch
'@quilted/react-async': patch
'@quilted/react-email': patch
'@quilted/react-dom': patch
'@quilted/browser': patch
'@quilted/graphql': patch
'@quilted/assets': patch
'@quilted/create': patch
'@quilted/quilt': patch
---

Refactor browser APIs
21 changes: 1 addition & 20 deletions documentation/features/http.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ export function NotFoundUi() {
}
```

## Reading cookies and other request headers
## Reading cookies

You can read cookies using the `useCookie` hook:

Expand All @@ -139,25 +139,6 @@ export function GuardWithAuth({children}: PropsWithChildren) {

On the server, these cookies are parsed from the `Cookie` request header. On the client, these cookies are parsed from `document.cookie`.

If you want to read other request headers, you can use the `useRequestHeader` hook:

```tsx
import {useRequestHeader} from '@quilted/quilt/http';

export function CheckForBrotli() {
// Don’t worry, headers are normalized, so any capitalization works!
const acceptEncoding = useRequestHeader('Accept-Encoding') ?? '';

return acceptEncoding.includes('br') ? (
<div>Request supports brotli!</div>
) : (
<div>Request does not support brotli :(</div>
);
}
```

Typically, request headers are only available on the server-side. When you read them using the `useRequestHeader` hooks, though, they are serialized into the HTML document so that they are also available on the client. **Make sure that you are comfortable exposing this header to the client before using the `useRequestHeader` hook.**

## Setting cookies and other response headers

You can set an HTTP cookie by using the `useResponseCookie` hook or `ResponseCookie` component. Both accept the cookie name, value, and [other cookie options](https://developer.mozilla.org/en-US/docs/Web/HTTP/Cookies).
Expand Down
92 changes: 0 additions & 92 deletions integrations/apollo/CHANGELOG.md

This file was deleted.

86 changes: 0 additions & 86 deletions integrations/apollo/README.md

This file was deleted.

74 changes: 0 additions & 74 deletions integrations/apollo/package.json

This file was deleted.

44 changes: 0 additions & 44 deletions integrations/apollo/source/ApolloProvider.tsx

This file was deleted.

2 changes: 0 additions & 2 deletions integrations/apollo/source/client.ts

This file was deleted.

1 change: 0 additions & 1 deletion integrations/apollo/source/index.ts

This file was deleted.

9 changes: 0 additions & 9 deletions integrations/apollo/source/parse.ts

This file was deleted.

0 comments on commit 7daafca

Please sign in to comment.