Skip to content

Commit 841d782

Browse files
authored
fix: fix framework server loading spinner ("Waiting for framework port") (#7242)
* fix: fix framework server loading spinner rendering This is a regression in the loading spinner shown before "Waiting for framework port", introduced in 19.0.3. * fix: fix framework server spinner See: 1. #7026 2. #7131 3. #7124 Oops, I was really overthinking this. All this needs to do is, every time a chunk comes in from the underlying framework dev server, clear the spinner line, write the chunk, then resume the spinner. This wasn't set up right at all, which was obfuscated by the erroneous use of `isSpinning` (see previous commit).
1 parent 5d70c98 commit 841d782

File tree

2 files changed

+4
-10
lines changed

2 files changed

+4
-10
lines changed

src/utils/framework-server.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ export const startFrameworkServer = async function ({
6868
throw new Error(`Timed out waiting for port '${settings.frameworkPort}' to be open`)
6969
}
7070
}
71-
stopSpinner({ error: false, spinner })
71+
spinner.success()
7272
} catch (error_) {
7373
stopSpinner({ error: true, spinner })
7474
log(NETLIFYDEVERR, `Netlify Dev could not start or connect to localhost:${settings.frameworkPort}.`)

src/utils/shell.ts

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { stripVTControlCharacters } from 'util'
44

55
import execa from 'execa'
66

7-
import { stopSpinner, type Spinner } from '../lib/spinner.js'
7+
import { type Spinner } from '../lib/spinner.js'
88

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

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

0 commit comments

Comments
 (0)