-
Notifications
You must be signed in to change notification settings - Fork 260
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4751f8e
commit cc24b10
Showing
21 changed files
with
111 additions
and
112 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1680,5 +1680,5 @@ | |
] | ||
} | ||
}, | ||
"version": "8.1.0" | ||
"version": "8.1.1" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
export const LIB_VERSION = '2024.4.3'; | ||
export const LIB_VERSION = '2024.4.4'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,75 @@ | ||
# skeleton | ||
|
||
## 2024.4.6 | ||
|
||
### Patch Changes | ||
|
||
- Remove manual setting of session in headers and recommend setting it in server after response is created. ([#2137](https://github.com/Shopify/hydrogen/pull/2137)) by [@michenly](https://github.com/michenly) | ||
|
||
Step 1: Add `isPending` implementation in session | ||
|
||
```diff | ||
// in app/lib/session.ts | ||
export class AppSession implements HydrogenSession { | ||
+ public isPending = false; | ||
|
||
get unset() { | ||
+ this.isPending = true; | ||
return this.#session.unset; | ||
} | ||
|
||
get set() { | ||
+ this.isPending = true; | ||
return this.#session.set; | ||
} | ||
|
||
commit() { | ||
+ this.isPending = false; | ||
return this.#sessionStorage.commitSession(this.#session); | ||
} | ||
} | ||
``` | ||
|
||
Step 2: update response header if `session.isPending` is true | ||
|
||
```diff | ||
// in server.ts | ||
export default { | ||
async fetch(request: Request): Promise<Response> { | ||
try { | ||
const response = await handleRequest(request); | ||
|
||
+ if (session.isPending) { | ||
+ response.headers.set('Set-Cookie', await session.commit()); | ||
+ } | ||
|
||
return response; | ||
} catch (error) { | ||
... | ||
} | ||
}, | ||
}; | ||
``` | ||
|
||
Step 3: remove setting cookie with session.commit() in routes | ||
|
||
```diff | ||
// in route files | ||
export async function loader({context}: LoaderFunctionArgs) { | ||
return json({}, | ||
- { | ||
- headers: { | ||
- 'Set-Cookie': await context.session.commit(), | ||
- }, | ||
}, | ||
); | ||
} | ||
``` | ||
|
||
- Updated dependencies [[`4337200c`](https://github.com/Shopify/hydrogen/commit/4337200c7908d56c039171c283a4d92c31a8b7b6), [`10a419bf`](https://github.com/Shopify/hydrogen/commit/10a419bf1db79cdfd8c41c0223ce695959f60da9), [`4337200c`](https://github.com/Shopify/hydrogen/commit/4337200c7908d56c039171c283a4d92c31a8b7b6), [`9eb60d73`](https://github.com/Shopify/hydrogen/commit/9eb60d73e552c3d22b9325ecbcd5878810893ad3), [`83cb96f4`](https://github.com/Shopify/hydrogen/commit/83cb96f42078bf79b20a153d8a8461f75d573ab1)]: | ||
- @shopify/[email protected] | ||
- @shopify/[email protected] | ||
|
||
## 2024.4.5 | ||
|
||
### Patch Changes | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters