Skip to content

Commit

Permalink
fix live reload port when explicitly set as a prop
Browse files Browse the repository at this point in the history
  • Loading branch information
pcattori committed Sep 7, 2023
1 parent 07ae5cc commit f43f23e
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
5 changes: 5 additions & 0 deletions .changeset/tidy-paws-promise.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@remix-run/react": patch
---

Fix live reload port when set explicitly as a prop
4 changes: 2 additions & 2 deletions packages/remix-react/__tests__/components-test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,14 @@ describe("<LiveReload />", () => {
LiveReload = require("../components").LiveReload;
let { container } = render(<LiveReload />);
expect(container.querySelector("script")).toHaveTextContent(
"url.port = undefined || REMIX_DEV_ORIGIN ? new URL(REMIX_DEV_ORIGIN).port : 8002;"
"url.port = undefined || (REMIX_DEV_ORIGIN ? new URL(REMIX_DEV_ORIGIN).port : 8002);"
);
});

it("can set the port explicitly", () => {
let { container } = render(<LiveReload port={4321} />);
expect(container.querySelector("script")).toHaveTextContent(
"url.port = 4321 || REMIX_DEV_ORIGIN ? new URL(REMIX_DEV_ORIGIN).port : 8002;"
"url.port = 4321 || (REMIX_DEV_ORIGIN ? new URL(REMIX_DEV_ORIGIN).port : 8002);"
);
});

Expand Down
3 changes: 1 addition & 2 deletions packages/remix-react/components.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1062,8 +1062,7 @@ export const LiveReload =
url.port =
${port} ||
REMIX_DEV_ORIGIN ? new URL(REMIX_DEV_ORIGIN).port :
8002;
(REMIX_DEV_ORIGIN ? new URL(REMIX_DEV_ORIGIN).port : 8002);
let ws = new WebSocket(url.href);
ws.onmessage = async (message) => {
Expand Down

0 comments on commit f43f23e

Please sign in to comment.