Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

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

Đang mở Phù hợp với người mới
#37,126 2 bình luận 1 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
76/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Ít trao đổi
Công nghệ
javascript, react
Lĩnh vực
devtools

Hướng nghiên cứu

Bắt đầu tại packages/react-devtools-shared/src/backend/utils/index.js, khoảng các dòng 185-233, và kiểm tra formatConsoleArgumentsToSingleString cùng với hành vi của hàm cùng nhóm formatConsoleArguments từ #36930. Xác minh các ví dụ có đối số thay thế bị thiếu và coi công việc là hoàn tất khi các specifier không khớp vẫn giữ nguyên dạng literal như trong đầu ra dự kiến.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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.

Ngôn ngữ chính
JavaScript
Star
251k
Fork
51.4k
Merge trung bình
2 ngày 1 giờ
Pull request đã merge (30 ngày)
51

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của react/react

Tất cả issue của react/react

Issue tương tự

Thêm issue về JavaScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.