Hacktoberfest 2026:維護者為十月標記出來的 issue,仍然開放、適合新手。 瀏覽 Hacktoberfest issue

Bug: DevTools single-string console formatter consumes missing substitution arguments

未關閉 適合新手
#37,126 2 則留言 1 個 reaction 已指派 0 人 在 GitHub 檢視

維護者通常 1 天內回覆

@Hashim1999164 已經在處理了。

開始於 2026年7月26日。

  • #37128 來自 @lazerg —— 已關閉,未合併
  • #37132 來自 @Hashim1999164 —— 未關閉
  • #37197 來自 @stareezy-1 —— 未關閉
  • #37287 來自 @Soumojitshome2023 —— 已關閉,未合併
  • #37291 來自 @SparshGarg999 —— 未關閉

評估

難度
2/5
預估耗時
1-3 小時
新手友好度
76/100
Issue 類型
缺陷
描述清晰度
描述清楚
活躍度
冷清
技術堆疊
javascript, react
領域
devtools

研究方向

從 packages/react-devtools-shared/src/backend/utils/index.js 的第185-233行附近開始,檢查 formatConsoleArgumentsToSingleString,並搭配 #36930 中同級函式 formatConsoleArguments 的行為進行查看。驗證缺少替換引數的範例,並在未匹配的指定符如預期輸出中一樣保持為字面值時,視為工作完成。

由索引模型根據 Issue 內容生成。

描述

React version: Current main (b685b40d)

Steps To Reproduce

  1. Call the DevTools helper with more substitution specifiers than arguments:
formatConsoleArgumentsToSingleString('%s %s', 'value');
formatConsoleArgumentsToSingleString('%d %d', 1);
  1. Observe the returned strings.

Link to code example:

https://github.com/react/react/blob/b685b40d9a719bee47422283fd86b5db2e4753ea/packages/react-devtools-shared/src/backend/utils/index.js#L185-L233

The current behavior

The helper shifts from an empty arguments array for the unmatched specifier, so it returns value undefined and 1 NaN.

This helper is used to build the message key for warnings and errors logged during render, commit, and passive effects. As a result, DevTools can track a different message from the one produced by the console.

The expected behavior

Unmatched specifiers should remain literal, matching browser console behavior and Node util.format:

value %s
1 %d

The sibling formatConsoleArguments helper was updated with this behavior in #36930, but formatConsoleArgumentsToSingleString still consumes a missing argument.

主要語言
JavaScript
星號
251k
分支
51.5k
平均合併
2 天 7 小時
30 天內合併 PR
30

環境準備

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

react/react 的其他 Issue

查看 react/react 的全部 Issue

相似的 Issue

更多 JavaScript Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。