Skip to content

fix: fix framework server loading spinner ("Waiting for framework port") #7242

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

Merged
merged 3 commits into from
May 1, 2025
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
2 changes: 1 addition & 1 deletion src/utils/framework-server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ export const startFrameworkServer = async function ({
throw new Error(`Timed out waiting for port '${settings.frameworkPort}' to be open`)
}
}
stopSpinner({ error: false, spinner })
spinner.success()
Copy link
Collaborator Author

@serhalp serhalp Apr 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We want to draw the ✔️, not erase it

} catch (error_) {
stopSpinner({ error: true, spinner })
log(NETLIFYDEVERR, `Netlify Dev could not start or connect to localhost:${settings.frameworkPort}.`)
Expand Down
12 changes: 3 additions & 9 deletions src/utils/shell.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { stripVTControlCharacters } from 'util'

import execa from 'execa'

import { stopSpinner, type Spinner } from '../lib/spinner.js'
import { type Spinner } from '../lib/spinner.js'

import { chalk, log, NETLIFYDEVERR, NETLIFYDEVWARN } from './command-helpers.js'
import { processOnExit } from './dev.js'
Expand Down Expand Up @@ -61,15 +61,9 @@ export const runCommand = (

// Ensure that an active spinner stays at the bottom of the commandline
// even though the actual framework command might be outputting stuff
if (spinner?.isSpinning) {
// The spinner is initially "started" in the usual sense (rendering frames on an interval).
// In this case, we want to manually control when to clear and when to render a frame, so we turn this off.
stopSpinner({ error: false, spinner })
}
const pipeDataWithSpinner = (writeStream: NodeJS.WriteStream, chunk: string | Uint8Array) => {
if (spinner?.isSpinning) {
spinner.clear()
}
// Clear the spinner, write the framework command line, then resume spinning
spinner?.clear()
writeStream.write(chunk, () => {
spinner?.spin()
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe this still isn't quite right — spin() renders a single frame, but here we want to keep looping even when we aren't receiving chunks from the framework server.

But this fix is worth getting in now and I'll follow up when I get the full fix working.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(In that follow-up I'll also look into how we can add test coverage for this)

})
Expand Down
Loading