Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix live reload port when explicitly set as a prop #7358

Merged
merged 1 commit into from
Sep 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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