{"record":{"id":"6629b2612a581ce0","repo":"necolas/react-native-web","slug":"message","errorCode":null,"errorMessage":"message","messagePattern":"message","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"packages/react-native-web/src/modules/warnOnce/index.js","lineNumber":25,"sourceCode":" * @flow strict\n */\n\nconst warnedKeys: { [string]: boolean, ... } = {};\n\n/**\n * A simple function that prints a warning message once per session.\n *\n * @param {string} key - The key used to ensure the message is printed once.\n *                       This should be unique to the callsite.\n * @param {string} message - The message to print\n */\nexport function warnOnce(key: string, message: string) {\n  if (process.env.NODE_ENV !== 'production') {\n    if (warnedKeys[key]) {\n      return;\n    }\n\n    console.warn(message);\n\n    warnedKeys[key] = true;\n  }\n}\n","sourceCodeStart":7,"sourceCodeEnd":30,"githubUrl":"https://github.com/necolas/react-native-web/blob/a9de220ba9e65bdea540fb5322ffb1da2b0bf442/packages/react-native-web/src/modules/warnOnce/index.js#L7-L30","documentation":"warnOnce is a dev-only helper that prints a console.warn for a given key exactly once per session, then records the key in warnedKeys to suppress repeats. The literal message string 'message' appears when a caller passes a placeholder or wrong argument — i.e. the actual warning text was not supplied (or a variable holding it was empty/undefined-coerced) so the user sees the unhelpful string 'message'. It never runs in production (NODE_ENV === 'production' returns early).","triggerScenarios":"Calling warnOnce(key, 'message') with the literal placeholder, or warnOnce(key, someVar) where someVar is undefined/misordered so the second positional string defaults to a template placeholder; in react-native-web internals, extractNonStandardStyleProps and preprocess invoke warnOnce with style-prop deprecation messages — a regression or bad merge passing the wrong literal surfaces this.","commonSituations":"Upgrading react-native-web and hitting a deprecation warning whose text was mistakenly left as a placeholder; local forks/patches editing the message argument; custom style preprocessing code calling warnOnce with swapped arguments (key and message reversed or message omitted).","solutions":["Find the warnOnce call site emitting the placeholder (extractNonStandardStyleProps or preprocess in style preprocessing) and pass the real deprecation text","Fix argument order: warnOnce(key, message) — ensure the descriptive string is the second argument","If you control the call, replace with the intended message e.g. warnOnce('displayInline', 'display: inline is not a valid...')","Check for upstream fix: this is an internal message bug — update react-native-web to a version where the call site text is correct"],"exampleFix":"// before\nwarnOnce('unsupportedStyle', 'message');\n// after\nwarnOnce('unsupportedStyle', 'Unsupported style prop \"' + name + '\" will be ignored.');","handlingStrategy":"validation","validationCode":"function callWarnOnce(key, message) {\n  if (typeof key !== 'string' || key.length === 0) throw new TypeError('warnOnce: key must be a non-empty string');\n  if (typeof message !== 'string' || message.length === 0 || message === 'message') throw new TypeError('warnOnce: message must be a descriptive string');\n  warnOnce(key, message);\n}","typeGuard":"function hasRealMessage(args) {\n  return args.length >= 2 && typeof args[1] === 'string' && args[1].length > 0;\n}","tryCatchPattern":null,"preventionTips":["Never pass placeholder literals like 'message' or 'TODO' as warning text","Lint for suspicious single-word/placeholder string arguments to warnOnce","Keep the argument order (key, message) in mind; write a small wrapper to enforce it","Gate warnOnce usage behind __DEV__/NODE_ENV checks since it is a no-op in production"],"tags":["deprecation","console-warning","dev-only"],"backgroundTag":"placeholder-warning-message","analyzedSha":"a9de220ba9e65bdea540fb5322ffb1da2b0bf442","analyzedAt":"2026-09-01T10:01:09.883Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T15:18:49.778Z"}