/
githubmirror
/
gutenberg
Обзор
Документация
Войти
/
githubmirror
/
gutenberg
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
trunk
tools/react-19/warn-compat.js
21 строка
633 B
Jarda Snajdr
React 19 patch: log warnings when polyfills are hit (#79624)
29 июн 2026, 15:55
Не верифицирован
29 июн 2026, 15:55
463e4a9
Код
Авторство
О чём код?
const PREFIX = '[wordpress-react-19]'; const warned = new Set(); /** * Warns about reliance on a React 18 compatibility shim that emulates an API * removed in React 19. Each distinct `key` warns at most once, so repeated use * of the same shim does not flood the console. * * @param {string} key Unique identifier for the compatibility warning. * @param {string} message Human-readable warning message. */ export function warnCompat( key, message ) { if ( warned.has( key ) ) { return; } warned.add( key ); if ( typeof console !== 'undefined' && console.warn ) { console.warn( `${ PREFIX } ${ message }` ); } }