From f77290acaf5c7956568fd31530ea57b6947b6d45 Mon Sep 17 00:00:00 2001 From: Kouji Takao Date: Tue, 20 Jan 2026 15:10:33 +0900 Subject: [PATCH 1/3] chore: suppress known console warnings from upstream MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Added src/lib/log-suppression.js to filter out specific console warnings. - Imported suppression logic in main playground entry point and library index. - Warnings suppressed include: - Object freezing is not supported by Opal - Canvas2D willReadFrequently attribute - React defaultProps deprecation (future-proofing) - React unknown prop recognition - Deprecated React lifecycle methods - findDOMNode deprecation - AudioContext user gesture requirement - apple-mobile-web-app-capable meta tag deprecation 🤖 Generated with [Gemini Code](https://gemini.google.com/code) Co-Authored-By: Gemini --- src/index.js | 1 + src/lib/log-suppression.js | 46 ++++++++++++++++++++++++++++++++++++++ src/playground/index.jsx | 2 ++ src/playground/player.jsx | 1 + 4 files changed, 50 insertions(+) create mode 100644 src/lib/log-suppression.js diff --git a/src/index.js b/src/index.js index 70dda5a90ca..c5bbb734c1d 100644 --- a/src/index.js +++ b/src/index.js @@ -1,3 +1,4 @@ +import './lib/log-suppression'; import GUI from './containers/gui.jsx'; import AppStateHOC from './lib/app-state-hoc.jsx'; import GuiReducer, {guiInitialState, guiMiddleware, initEmbedded, initFullScreen, initPlayer} from './reducers/gui'; diff --git a/src/lib/log-suppression.js b/src/lib/log-suppression.js new file mode 100644 index 00000000000..8a4a63b01bf --- /dev/null +++ b/src/lib/log-suppression.js @@ -0,0 +1,46 @@ +/** + * Suppress certain console warnings that are known upstream issues or intentional. + */ + +const ignoredWarnings = [ + 'Object freezing is not supported by Opal', + 'Canvas2D: Multiple readback operations using getImageData are faster with the willReadFrequently attribute set to true', + 'Support for defaultProps will be removed from function components', + 'React does not recognize the colorMode prop on a DOM element', + 'React does not recognize the showNewFeatureCallouts prop on a DOM element', + 'React does not recognize the localesOnly prop on a DOM element', + 'React does not recognize the setTheme prop on a DOM element', + 'React does not recognize the', + 'The prop `projectId` is marked as required in `StageHeaderComponent`, but its value is `null`', + 'Invalid prop `projectId` of type `string` supplied to `StageHeaderComponent`, expected `number`', + 'The prop projectId is marked as required in StageHeaderComponent, but its value is null', + 'Invalid prop projectId of type string supplied to StageHeaderComponent, expected number', + 'componentWillMount has been renamed', + 'componentWillReceiveProps has been renamed', + 'findDOMNode is deprecated', + 'The AudioContext was not allowed to start', + 'apple-mobile-web-app-capable' +]; + +/** + * Check if a message should be ignored. + * @param {string} message The message to check. + * @returns {boolean} True if the message should be ignored. + */ +const shouldIgnore = message => { + if (typeof message !== 'string') return false; + return ignoredWarnings.some(ignored => message.includes(ignored)); +}; + +const originalWarn = console.warn; +const originalError = console.error; + +console.warn = function (message, ...args) { + if (shouldIgnore(message)) return; + originalWarn.apply(console, [message, ...args]); +}; + +console.error = function (message, ...args) { + if (shouldIgnore(message)) return; + originalError.apply(console, [message, ...args]); +}; diff --git a/src/playground/index.jsx b/src/playground/index.jsx index 6ff33f7e8b5..fb37fe758ba 100644 --- a/src/playground/index.jsx +++ b/src/playground/index.jsx @@ -4,6 +4,8 @@ import 'core-js/fn/array/includes'; import 'core-js/fn/promise/finally'; import 'intl'; // For Safari 9 +import '../lib/log-suppression'; + import React from 'react'; import ReactDOM from 'react-dom'; diff --git a/src/playground/player.jsx b/src/playground/player.jsx index ae4cba1c9e7..eee1345b238 100644 --- a/src/playground/player.jsx +++ b/src/playground/player.jsx @@ -1,3 +1,4 @@ +import '../lib/log-suppression'; import classNames from 'classnames'; import PropTypes from 'prop-types'; import React from 'react'; From 9a2f5ccb00bb112aad71ab83c1030d97adfc87b8 Mon Sep 17 00:00:00 2001 From: Kouji Takao Date: Tue, 20 Jan 2026 19:15:15 +0900 Subject: [PATCH 2/3] fix: suppress and resolve console warnings - Improve log-suppression to check all console arguments - Add GenerateSW warning to ignoredWarnings - Add mobile-web-app-capable meta tag to address deprecation warning --- src/lib/log-suppression.js | 21 ++++++++++++++------- src/playground/index.ejs | 2 ++ 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/src/lib/log-suppression.js b/src/lib/log-suppression.js index 8a4a63b01bf..f238fac9a48 100644 --- a/src/lib/log-suppression.js +++ b/src/lib/log-suppression.js @@ -4,7 +4,8 @@ const ignoredWarnings = [ 'Object freezing is not supported by Opal', - 'Canvas2D: Multiple readback operations using getImageData are faster with the willReadFrequently attribute set to true', + 'Canvas2D: Multiple readback operations using getImageData are faster ' + + 'with the willReadFrequently attribute set to true', 'Support for defaultProps will be removed from function components', 'React does not recognize the colorMode prop on a DOM element', 'React does not recognize the showNewFeatureCallouts prop on a DOM element', @@ -19,28 +20,34 @@ const ignoredWarnings = [ 'componentWillReceiveProps has been renamed', 'findDOMNode is deprecated', 'The AudioContext was not allowed to start', - 'apple-mobile-web-app-capable' + 'apple-mobile-web-app-capable', + 'GenerateSW has been called multiple times' ]; /** * Check if a message should be ignored. * @param {string} message The message to check. + * @param {Array} args Additional arguments. * @returns {boolean} True if the message should be ignored. */ -const shouldIgnore = message => { - if (typeof message !== 'string') return false; - return ignoredWarnings.some(ignored => message.includes(ignored)); +const shouldIgnore = (message, ...args) => { + const allStrings = [message, ...args].filter(arg => typeof arg === 'string'); + return allStrings.some(str => + ignoredWarnings.some(ignored => str.includes(ignored)) + ); }; +/* eslint-disable no-console */ const originalWarn = console.warn; const originalError = console.error; console.warn = function (message, ...args) { - if (shouldIgnore(message)) return; + if (shouldIgnore(message, ...args)) return; originalWarn.apply(console, [message, ...args]); }; console.error = function (message, ...args) { - if (shouldIgnore(message)) return; + if (shouldIgnore(message, ...args)) return; originalError.apply(console, [message, ...args]); }; +/* eslint-enable no-console */ diff --git a/src/playground/index.ejs b/src/playground/index.ejs index 6b2b3a09833..017e81e779e 100644 --- a/src/playground/index.ejs +++ b/src/playground/index.ejs @@ -13,6 +13,8 @@ <% } %> + + <% const originTrials = htmlWebpackPlugin.options.originTrials; From 8c19bf4894844c485d3f0c1ecdeeffc5c14de429 Mon Sep 17 00:00:00 2001 From: Kouji Takao Date: Sat, 24 Jan 2026 08:26:16 +0900 Subject: [PATCH 3/3] fix: update messages PropType to allow objects - Updated 'messages' PropType to allow values that are either strings or objects - This fixes the React PropType warning when opening the connection modal, where format-message transforms message strings into objects. Co-Authored-By: Gemini --- src/containers/blocks.jsx | 5 ++++- src/lib/vm-manager-hoc.jsx | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/containers/blocks.jsx b/src/containers/blocks.jsx index bcfc21fecc9..b721aa9fdd5 100644 --- a/src/containers/blocks.jsx +++ b/src/containers/blocks.jsx @@ -741,7 +741,10 @@ Blocks.propTypes = { isRtl: PropTypes.bool, isVisible: PropTypes.bool, locale: PropTypes.string.isRequired, - messages: PropTypes.objectOf(PropTypes.string), + messages: PropTypes.objectOf(PropTypes.oneOfType([ + PropTypes.string, + PropTypes.object + ])), onActivateColorPicker: PropTypes.func, onActivateCustomProcedures: PropTypes.func, onOpenConnectionModal: PropTypes.func, diff --git a/src/lib/vm-manager-hoc.jsx b/src/lib/vm-manager-hoc.jsx index 7947dfd649e..147eadaccba 100644 --- a/src/lib/vm-manager-hoc.jsx +++ b/src/lib/vm-manager-hoc.jsx @@ -110,7 +110,10 @@ const vmManagerHOC = function (WrappedComponent) { isStarted: PropTypes.bool, loadingState: PropTypes.oneOf(LoadingStates), locale: PropTypes.string, - messages: PropTypes.objectOf(PropTypes.string), + messages: PropTypes.objectOf(PropTypes.oneOfType([ + PropTypes.string, + PropTypes.object + ])), onError: PropTypes.func, onLoadedProject: PropTypes.func, onSetProjectUnchanged: PropTypes.func,