Skip to content

Commit

Permalink
Merge pull request #228 from remix-pwa/dev
Browse files Browse the repository at this point in the history
Moving runtime patches to `latest`
  • Loading branch information
ShafSpecs committed May 13, 2024
2 parents e40ed5b + 64390c7 commit c9c5007
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 11 deletions.
15 changes: 7 additions & 8 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions packages/worker-runtime/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
## @remix-pwa/worker-runtime 2.1.2-dev.1 (2024-05-13)


### Bug Fixes

* **worker-runtime:** fixed handling of successful non-remix responses 1ea232d

## @remix-pwa/worker-runtime 2.1.1 (2024-04-08)


Expand Down
2 changes: 1 addition & 1 deletion packages/worker-runtime/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@remix-pwa/worker-runtime",
"version": "2.1.1",
"version": "2.1.2-dev.1",
"description": "A vanilla JavaScript worker runtime for Remix service workers",
"license": "MIT",
"sideEffects": false,
Expand Down
13 changes: 12 additions & 1 deletion packages/worker-runtime/src/utils/handle-request.ts
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,17 @@ function responseHandler(response: Response): Response {

// Mark all successful responses with a header so we can identify in-flight
// network errors that are missing this header
!isRemixResponse(response) && response.headers.set('X-Remix-Response', 'yes');
const isNotRemixResponse = !isRemixResponse(response);
const headers = isNotRemixResponse ? new Headers(response.headers) : response.headers;
if (isNotRemixResponse) {
headers.set('X-Remix-Response', 'yes');

if (response.status < 200) {
return new Response(response.body, { headers });
}

return new Response(response.body, { headers, status: response.status, statusText: response.statusText });
}

return response;
}
2 changes: 1 addition & 1 deletion playground/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
},
"dependencies": {
"@remix-pwa/client": "3.0.4",
"@remix-pwa/push": "2.10.0",
"@remix-pwa/push": "2.10.1",
"@remix-pwa/sw": "3.0.5",
"@remix-pwa/sync": "3.0.0",
"@remix-pwa/worker-runtime": "2.1.1",
Expand Down

0 comments on commit c9c5007

Please sign in to comment.