-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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(remix-dev): re-use REMIX_DEV_SERVER_WS_PORT
when reloading config
#3206
Conversation
REMIX_DEV_SERVER_WS_PORT
when reloading config
Confirmed, but on second thought this behavior might be desirable. This PR makes (Note that you still get the advantage of getPort if |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! What do you think about this?
a8aec5f
to
97d385e
Compare
closes REM-1091 closes #2958 Signed-off-by: Logan McAnsh <logan@mcan.sh>
97d385e
to
9b9ad25
Compare
packages/remix-dev/config.ts
Outdated
if (process.env.REMIX_DEV_SERVER_WS_PORT) { | ||
try { | ||
devServerPort = Number(process.env.REMIX_DEV_SERVER_WS_PORT); | ||
} catch (error: unknown) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm unsure if Number
ever throws an error. In most cases it will return NaN
instead.
In this part of the code, it would mean that someone explicitly set the env var to an invalid value. If it wasn't set explicitly, then it would either 1) fall through to getPort
on the initial load, or 2) have been set to the output of getPort
on a previous load.
Is getPort
as default the right thing to do if someone explicitly sets the env var to an invalid value? (Genuinely curious as to the philosophy of the Remix team.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yup, you're right on the NaN, Mondays amirite 😅. i'll wait for @kentcdodds' thoughts on the default behavior, i could see throwing an error as the desired behavior
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome. :) Thanks so much for working on this. I'm excited to see LiveReload working again!
Signed-off-by: Logan McAnsh <logan@mcan.sh>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another thought
Co-authored-by: Kent C. Dodds <me+github@kentcdodds.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sweet! Thanks 👏👏
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Whoops 😅 Ok, should be good now!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I really shouldn't use our CI as my development environment 😅
🤖 Hello there, We just published version Thanks! |
🤖 Hello there, We just published version Thanks! |
Hi team, This breaks out of the box hot-reload with some of the templates (eg: just the basics + express) as the used port is different from the expected This is because the new code gets a random available port if the environment variable isn't set - it's undefined for the templates as Should the templates be updated to have |
@EkaanshArora, thanks. @mcansh is going to look into this. |
Any updates on this issue? |
closes REM-1091
closes #2958
Signed-off-by: Logan McAnsh logan@mcan.sh
Testing Strategy:
I opened up a new playground (
npm run playground:new
) with a basic node server running on port 8002 and then created a few new files to trigger the config reload while logging the currentREMIX_DEV_SERVER_WS_PORT
.