Skip to content

Commit

Permalink
Merge branch 'feat/ssr-middleware' of github.com:dac09/redwood into f…
Browse files Browse the repository at this point in the history
…eat/ssr-middleware

* 'feat/ssr-middleware' of github.com:dac09/redwood:
  Apply suggestions from Tobbe's review
  Apply suggestions from Tobbe's review
  Update installation.md (redwoodjs#9887)
  • Loading branch information
dac09 committed Jan 30, 2024
2 parents 20b18d8 + 2a5b72d commit 6e89b52
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 11 deletions.
1 change: 1 addition & 0 deletions docs/docs/tutorial/chapter1/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ You'll have a new directory `redwoodblog` containing several directories and fil

```bash
cd redwoodblog
yarn install
yarn redwood dev
```

Expand Down
2 changes: 1 addition & 1 deletion packages/auth/src/AuthProvider/ServerAuthProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export const ServerAuthContext = React.createContext<ServerAuthState>(
getAuthInitialStateFromServer()
)

/***
/**
* Note: This only gets rendered on the server and serves two purposes:
* 1) On the server, it sets the auth state
* 2) On the client, it restores the auth state from the initial server render
Expand Down
7 changes: 2 additions & 5 deletions packages/vite/src/middleware/CookieJar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export type CookieParams = {

/**
* Specialised cookie map, that lets you set cookies with options
* */
*/
export class CookieJar {
private map = new Map<string, CookieParams>()

Expand Down Expand Up @@ -59,10 +59,7 @@ export class CookieJar {
})
}

/**
* Clear all cookies, or remove a specific cookie
* from the jar.
*/
/** Clear all cookies, or remove a specific cookie from the jar */
public clear(name?: string) {
if (name) {
this.map.delete(name)
Expand Down
4 changes: 2 additions & 2 deletions packages/vite/src/middleware/MiddlewareRequest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ export class MiddlewareRequest extends WhatWgRequest {
}

/**
* Converts a Web API Request object to a MiddlewareRequest object
* also ensures that serverAuthContext is fresh for each request
* Converts a Web API Request object to a MiddlewareRequest object.
* Also ensures that serverAuthContext is fresh for each request
* (assuming that it is a new instance for each request)
*/
export const createMiddlewareRequest = (req: Request) => {
Expand Down
2 changes: 1 addition & 1 deletion packages/vite/src/streaming/createReactStreamingHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ export const createReactStreamingHandler = async (
}
}

// If mwResponse is a redirect, short-circuit here, and skip react rendering
// If mwResponse is a redirect, short-circuit here, and skip React rendering
// @TODO should we also check if its a full response object? Next allows this... just to maintain symmetry
if (mwResponse.isRedirect()) {
return mwResponse.toResponse()
Expand Down
3 changes: 1 addition & 2 deletions packages/web/src/apollo/suspense.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -164,8 +164,7 @@ const ApolloProviderWithFetchConfig: React.FunctionComponent<{
serverAuthState?.cookieHeader
),
},
// filter boolean doesn't play nice with TS
].filter((link): link is RedwoodApolloLink<any> => !!link)
].filter((link): link is RedwoodApolloLinks[number] => !!link)

function makeClient() {
// @MARK use special Apollo client
Expand Down

0 comments on commit 6e89b52

Please sign in to comment.