Skip to content

Commit 3132d5d

Browse files
fix: prevent duplicate printAppInfo output in StrictMode
React StrictMode double-invokes effects in development, causing the app info banner to print twice. Add a module-level guard so it only prints once.
1 parent 6212380 commit 3132d5d

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

src/utils/printAppInfo.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
import { name, version } from '../../package.json'
22

3+
let printed = false
4+
35
export function printAppInfo() {
6+
if (printed) return
7+
printed = true
48
// if running on server (NODE_ENV is defined), do nothing
59
if (typeof process !== 'undefined' && process.env?.NODE_ENV) {
610
return

0 commit comments

Comments
 (0)