Unverified Commit 982fff33 authored by Jiachi Liu's avatar Jiachi Liu Committed by GitHub

Always display version indicator (#74774)

### What

Remove the condition to check when version indicator can be displayed as
it doesn't have to be coupled with test mode or telemetry
parent 4ef926bc
...@@ -631,9 +631,7 @@ export async function createHotReloaderTurbopack( ...@@ -631,9 +631,7 @@ export async function createHotReloaderTurbopack(
getNextErrorFeedbackMiddleware(opts.telemetry), getNextErrorFeedbackMiddleware(opts.telemetry),
] ]
const versionInfoPromise = getVersionInfo( const versionInfoPromise = getVersionInfo()
isTestMode || opts.telemetry.isEnabled
)
let devtoolsFrontendUrl: string | undefined let devtoolsFrontendUrl: string | undefined
const nodeDebugType = getNodeDebugType() const nodeDebugType = getNodeDebugType()
......
...@@ -86,11 +86,6 @@ import { getNodeDebugType } from '../lib/utils' ...@@ -86,11 +86,6 @@ import { getNodeDebugType } from '../lib/utils'
import { getNextErrorFeedbackMiddleware } from '../../client/components/react-dev-overlay/server/get-next-error-feedback-middleware' import { getNextErrorFeedbackMiddleware } from '../../client/components/react-dev-overlay/server/get-next-error-feedback-middleware'
const MILLISECONDS_IN_NANOSECOND = BigInt(1_000_000) const MILLISECONDS_IN_NANOSECOND = BigInt(1_000_000)
const isTestMode = !!(
process.env.NEXT_TEST_MODE ||
process.env.__NEXT_TEST_MODE ||
process.env.DEBUG
)
function diff(a: Set<any>, b: Set<any>) { function diff(a: Set<any>, b: Set<any>) {
return new Set([...a].filter((v) => !b.has(v))) return new Set([...a].filter((v) => !b.has(v)))
...@@ -196,13 +191,9 @@ function erroredPages(compilation: webpack.Compilation) { ...@@ -196,13 +191,9 @@ function erroredPages(compilation: webpack.Compilation) {
return failedPages return failedPages
} }
export async function getVersionInfo(enabled: boolean): Promise<VersionInfo> { export async function getVersionInfo(): Promise<VersionInfo> {
let installed = '0.0.0' let installed = '0.0.0'
if (!enabled) {
return { installed, staleness: 'unknown' }
}
try { try {
installed = require('next/package.json').version installed = require('next/package.json').version
...@@ -751,10 +742,10 @@ export default class HotReloaderWebpack implements NextJsHotReloaderInterface { ...@@ -751,10 +742,10 @@ export default class HotReloaderWebpack implements NextJsHotReloaderInterface {
}) })
} }
private async tracedGetVersionInfo(span: Span, enabled: boolean) { private async tracedGetVersionInfo(span: Span) {
const versionInfoSpan = span.traceChild('get-version-info') const versionInfoSpan = span.traceChild('get-version-info')
return versionInfoSpan.traceAsyncFn<VersionInfo>(async () => return versionInfoSpan.traceAsyncFn<VersionInfo>(async () =>
getVersionInfo(enabled) getVersionInfo()
) )
} }
...@@ -762,10 +753,7 @@ export default class HotReloaderWebpack implements NextJsHotReloaderInterface { ...@@ -762,10 +753,7 @@ export default class HotReloaderWebpack implements NextJsHotReloaderInterface {
const startSpan = this.hotReloaderSpan.traceChild('start') const startSpan = this.hotReloaderSpan.traceChild('start')
startSpan.stop() // Stop immediately to create an artificial parent span startSpan.stop() // Stop immediately to create an artificial parent span
this.versionInfo = await this.tracedGetVersionInfo( this.versionInfo = await this.tracedGetVersionInfo(startSpan)
startSpan,
isTestMode || this.telemetry.isEnabled
)
const nodeDebugType = getNodeDebugType() const nodeDebugType = getNodeDebugType()
if (nodeDebugType && !this.devtoolsFrontendUrl) { if (nodeDebugType && !this.devtoolsFrontendUrl) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment