From 3222ed4b299a88a27d7e090d58811100972d7a7d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A1bio=20Henriques?= Date: Wed, 26 Mar 2025 20:54:59 +0000 Subject: [PATCH 1/9] Bump Onyx to 2.0.95 --- package-lock.json | 8 ++++---- package.json | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package-lock.json b/package-lock.json index 9bee41cdb692..c35e9dc80403 100644 --- a/package-lock.json +++ b/package-lock.json @@ -103,7 +103,7 @@ "react-native-launch-arguments": "^4.0.2", "react-native-localize": "^2.2.6", "react-native-modal": "^13.0.0", - "react-native-onyx": "2.0.94", + "react-native-onyx": "2.0.95", "react-native-pager-view": "6.5.2", "react-native-pdf": "6.7.3", "react-native-performance": "^5.1.0", @@ -33512,9 +33512,9 @@ } }, "node_modules/react-native-onyx": { - "version": "2.0.94", - "resolved": "https://registry.npmjs.org/react-native-onyx/-/react-native-onyx-2.0.94.tgz", - "integrity": "sha512-SyYkZwR+rB2X99Ae2GDyyu7mwF3WOqaAZZIzu/I88vmsAW7IK4MrUm8d9aY7PFpk+HyQBgaGkW5dTxWDYiSV3g==", + "version": "2.0.95", + "resolved": "https://registry.npmjs.org/react-native-onyx/-/react-native-onyx-2.0.95.tgz", + "integrity": "sha512-1r0WSM3Kog+bjWmQjMQ+JHbwmRBegUvLYJATEwoNlrAREwUBHjjMaFc5DvucigwrT8vMrR0KO34vxiCNWFal/Q==", "license": "MIT", "dependencies": { "ascii-table": "0.0.9", diff --git a/package.json b/package.json index aee35c3c2180..492edb6721f7 100644 --- a/package.json +++ b/package.json @@ -170,7 +170,7 @@ "react-native-launch-arguments": "^4.0.2", "react-native-localize": "^2.2.6", "react-native-modal": "^13.0.0", - "react-native-onyx": "2.0.94", + "react-native-onyx": "2.0.95", "react-native-pager-view": "6.5.2", "react-native-pdf": "6.7.3", "react-native-performance": "^5.1.0", From 8b4a29723ccee0d51fb42ad3060923141ea95ec3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A1bio=20Henriques?= Date: Wed, 26 Mar 2025 20:58:08 +0000 Subject: [PATCH 2/9] Bump Expensify ESLint to 2.0.78 --- package-lock.json | 8 ++++---- package.json | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package-lock.json b/package-lock.json index c35e9dc80403..83b3ec7c315a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -231,7 +231,7 @@ "electron-builder": "25.0.0", "eslint": "^8.57.0", "eslint-config-airbnb-typescript": "^18.0.0", - "eslint-config-expensify": "2.0.75", + "eslint-config-expensify": "2.0.78", "eslint-config-prettier": "^9.1.0", "eslint-plugin-deprecation": "^3.0.0", "eslint-plugin-jest": "^28.6.0", @@ -21483,9 +21483,9 @@ } }, "node_modules/eslint-config-expensify": { - "version": "2.0.75", - "resolved": "https://registry.npmjs.org/eslint-config-expensify/-/eslint-config-expensify-2.0.75.tgz", - "integrity": "sha512-eSzQpxmVMGGXZSoB7aPZoWh75NC3oStyQnd+1JBFUQMDrdCyWjkMl8UJjzBqp/dOHazmVgLQUS1vDfk5cGXe6Q==", + "version": "2.0.78", + "resolved": "https://registry.npmjs.org/eslint-config-expensify/-/eslint-config-expensify-2.0.78.tgz", + "integrity": "sha512-YcTdhAuWtqUajfBymq1V0Ot190GoI1VBZWXMn3IQLpq4aB2uNU6jZt5AcrErOiLJUOGUz+pRDyZ8ynHkzqeH+A==", "dev": true, "license": "ISC", "dependencies": { diff --git a/package.json b/package.json index 492edb6721f7..58c8a80b7233 100644 --- a/package.json +++ b/package.json @@ -298,7 +298,7 @@ "electron-builder": "25.0.0", "eslint": "^8.57.0", "eslint-config-airbnb-typescript": "^18.0.0", - "eslint-config-expensify": "2.0.75", + "eslint-config-expensify": "2.0.78", "eslint-config-prettier": "^9.1.0", "eslint-plugin-deprecation": "^3.0.0", "eslint-plugin-jest": "^28.6.0", From e176d98d08053190471e1abd2a4da42b5cf49695 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A1bio=20Henriques?= Date: Wed, 26 Mar 2025 21:05:32 +0000 Subject: [PATCH 3/9] Enable provide-canBeMissing-in-useOnyx rule --- .eslintrc.changed.js | 1 + 1 file changed, 1 insertion(+) diff --git a/.eslintrc.changed.js b/.eslintrc.changed.js index 356ad936e1fd..d06565209e8c 100644 --- a/.eslintrc.changed.js +++ b/.eslintrc.changed.js @@ -7,6 +7,7 @@ module.exports = { rules: { 'deprecation/deprecation': 'error', 'rulesdir/no-default-id-values': 'error', + 'rulesdir/provide-canBeMissing-in-useOnyx': 'error', 'no-restricted-syntax': [ 'error', { From 78989169f130896f43d4a34d0e908cf5732016d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A1bio=20Henriques?= Date: Wed, 26 Mar 2025 21:06:15 +0000 Subject: [PATCH 4/9] Display visual alert --- src/Expensify.tsx | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/src/Expensify.tsx b/src/Expensify.tsx index 135423808885..a927a317631f 100644 --- a/src/Expensify.tsx +++ b/src/Expensify.tsx @@ -4,6 +4,7 @@ import type {NativeEventSubscription} from 'react-native'; import {AppState, Linking, Platform} from 'react-native'; import type {OnyxEntry} from 'react-native-onyx'; import Onyx, {useOnyx} from 'react-native-onyx'; +import alert from './components/Alert'; import ConfirmModal from './components/ConfirmModal'; import DeeplinkWrapper from './components/DeeplinkWrapper'; import EmojiPicker from './components/EmojiPicker/EmojiPicker'; @@ -24,6 +25,7 @@ import * as EmojiPickerAction from './libs/actions/EmojiPickerAction'; import * as Report from './libs/actions/Report'; import * as User from './libs/actions/User'; import * as ActiveClientManager from './libs/ActiveClientManager'; +import * as Environment from './libs/Environment/Environment'; import FS from './libs/Fullstory'; import * as Growl from './libs/Growl'; import Log from './libs/Log'; @@ -45,14 +47,21 @@ import type {Route} from './ROUTES'; import SplashScreenStateContext from './SplashScreenStateContext'; import type {ScreenShareRequest} from './types/onyx'; -Onyx.registerLogger(({level, message}) => { +Onyx.registerLogger(({level, message, parameters}) => { if (level === 'alert') { - Log.alert(message); + Log.alert(message, parameters); console.error(message); + + // useOnyx() calls with "canBeMissing" config set to false will display a visual alert in dev environment + // when they doesn't return data. + const shouldShowAlert = typeof parameters === 'object' && !Array.isArray(parameters) && 'showAlert' in parameters; + if (Environment.isDevelopment() && shouldShowAlert) { + alert(message); + } } else if (level === 'hmmm') { - Log.hmmm(message); + Log.hmmm(message, parameters); } else { - Log.info(message); + Log.info(message, undefined, parameters); } }); From 10dc59861a4a400fb56aae9e0f45b66027c22458 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A1bio=20Henriques?= Date: Fri, 28 Mar 2025 19:11:26 +0000 Subject: [PATCH 5/9] Bump Onyx to 2.0.96 --- package-lock.json | 8 ++++---- package.json | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package-lock.json b/package-lock.json index cdbf9d5bef08..8f26cca6c9fc 100644 --- a/package-lock.json +++ b/package-lock.json @@ -103,7 +103,7 @@ "react-native-launch-arguments": "^4.0.2", "react-native-localize": "^2.2.6", "react-native-modal": "^13.0.0", - "react-native-onyx": "2.0.95", + "react-native-onyx": "2.0.96", "react-native-pager-view": "6.5.2", "react-native-pdf": "6.7.3", "react-native-performance": "^5.1.0", @@ -33512,9 +33512,9 @@ } }, "node_modules/react-native-onyx": { - "version": "2.0.95", - "resolved": "https://registry.npmjs.org/react-native-onyx/-/react-native-onyx-2.0.95.tgz", - "integrity": "sha512-1r0WSM3Kog+bjWmQjMQ+JHbwmRBegUvLYJATEwoNlrAREwUBHjjMaFc5DvucigwrT8vMrR0KO34vxiCNWFal/Q==", + "version": "2.0.96", + "resolved": "https://registry.npmjs.org/react-native-onyx/-/react-native-onyx-2.0.96.tgz", + "integrity": "sha512-K7nvJyA1a+44//Y/mOdBVVE5lwJR1nAUlPb60Xb+v7OA5NVkePKgjje4NIfjgtO8FvUEbhCS5zZ7gYH6extmgg==", "license": "MIT", "dependencies": { "ascii-table": "0.0.9", diff --git a/package.json b/package.json index 7cc6b0b5cb0e..b6396a17f047 100644 --- a/package.json +++ b/package.json @@ -170,7 +170,7 @@ "react-native-launch-arguments": "^4.0.2", "react-native-localize": "^2.2.6", "react-native-modal": "^13.0.0", - "react-native-onyx": "2.0.95", + "react-native-onyx": "2.0.96", "react-native-pager-view": "6.5.2", "react-native-pdf": "6.7.3", "react-native-performance": "^5.1.0", From a8781a7e3bab0fed3982060963a65a8244ad7537 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A1bio=20Henriques?= Date: Wed, 2 Apr 2025 07:37:19 +0100 Subject: [PATCH 6/9] Bump Onyx to 2.0.98 --- package-lock.json | 8 ++++---- package.json | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package-lock.json b/package-lock.json index 04a6f3beb718..17b169f2e81f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -103,7 +103,7 @@ "react-native-launch-arguments": "^4.0.2", "react-native-localize": "^2.2.6", "react-native-modal": "^13.0.0", - "react-native-onyx": "2.0.96", + "react-native-onyx": "2.0.98", "react-native-pager-view": "6.5.2", "react-native-pdf": "6.7.3", "react-native-performance": "^5.1.0", @@ -33512,9 +33512,9 @@ } }, "node_modules/react-native-onyx": { - "version": "2.0.96", - "resolved": "https://registry.npmjs.org/react-native-onyx/-/react-native-onyx-2.0.96.tgz", - "integrity": "sha512-K7nvJyA1a+44//Y/mOdBVVE5lwJR1nAUlPb60Xb+v7OA5NVkePKgjje4NIfjgtO8FvUEbhCS5zZ7gYH6extmgg==", + "version": "2.0.98", + "resolved": "https://registry.npmjs.org/react-native-onyx/-/react-native-onyx-2.0.98.tgz", + "integrity": "sha512-mGYkX2LW3e2QKBh7taVqOg8G8ajv6/XnUNumpWzNAE0Q6XBCpIq/GFwfsZNJ8Cy0Mr0EXkqBh4fsXTLNf/eBhw==", "license": "MIT", "dependencies": { "ascii-table": "0.0.9", diff --git a/package.json b/package.json index 583c5b964605..3639c45b1272 100644 --- a/package.json +++ b/package.json @@ -170,7 +170,7 @@ "react-native-launch-arguments": "^4.0.2", "react-native-localize": "^2.2.6", "react-native-modal": "^13.0.0", - "react-native-onyx": "2.0.96", + "react-native-onyx": "2.0.98", "react-native-pager-view": "6.5.2", "react-native-pdf": "6.7.3", "react-native-performance": "^5.1.0", From 51601387d6badf1e2f00c98f63d10326accc1dff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A1bio=20Henriques?= Date: Mon, 7 Apr 2025 10:56:58 +0100 Subject: [PATCH 7/9] Append key string to the alert --- src/Expensify.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Expensify.tsx b/src/Expensify.tsx index 05f3a44ab389..9d0a0afeb07d 100644 --- a/src/Expensify.tsx +++ b/src/Expensify.tsx @@ -54,9 +54,9 @@ Onyx.registerLogger(({level, message, parameters}) => { // useOnyx() calls with "canBeMissing" config set to false will display a visual alert in dev environment // when they doesn't return data. - const shouldShowAlert = typeof parameters === 'object' && !Array.isArray(parameters) && 'showAlert' in parameters; + const shouldShowAlert = typeof parameters === 'object' && !Array.isArray(parameters) && 'showAlert' in parameters && 'key' in parameters; if (Environment.isDevelopment() && shouldShowAlert) { - alert(message); + alert(`${message} Key: ${parameters.key as string}`); } } else if (level === 'hmmm') { Log.hmmm(message, parameters); From e6acb78b4ca0e7f9300405d174f4bccbcb00026b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A1bio=20Henriques?= Date: Sun, 13 Apr 2025 21:14:35 +0100 Subject: [PATCH 8/9] Add canBeMissing to Expensify.tsx useOnyx calls --- src/Expensify.tsx | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/Expensify.tsx b/src/Expensify.tsx index 9d0a0afeb07d..8cc0e6e58693 100644 --- a/src/Expensify.tsx +++ b/src/Expensify.tsx @@ -94,17 +94,17 @@ function Expensify() { const {splashScreenState, setSplashScreenState} = useContext(SplashScreenStateContext); const [hasAttemptedToOpenPublicRoom, setAttemptedToOpenPublicRoom] = useState(false); const {translate} = useLocalize(); - const [account] = useOnyx(ONYXKEYS.ACCOUNT); - const [session] = useOnyx(ONYXKEYS.SESSION); - const [lastRoute] = useOnyx(ONYXKEYS.LAST_ROUTE); - const [userMetadata] = useOnyx(ONYXKEYS.USER_METADATA); - const [isCheckingPublicRoom] = useOnyx(ONYXKEYS.IS_CHECKING_PUBLIC_ROOM, {initWithStoredValues: false}); - const [updateAvailable] = useOnyx(ONYXKEYS.UPDATE_AVAILABLE, {initWithStoredValues: false}); - const [updateRequired] = useOnyx(ONYXKEYS.UPDATE_REQUIRED, {initWithStoredValues: false}); - const [isSidebarLoaded] = useOnyx(ONYXKEYS.IS_SIDEBAR_LOADED); - const [screenShareRequest] = useOnyx(ONYXKEYS.SCREEN_SHARE_REQUEST); - const [focusModeNotification] = useOnyx(ONYXKEYS.FOCUS_MODE_NOTIFICATION, {initWithStoredValues: false}); - const [lastVisitedPath] = useOnyx(ONYXKEYS.LAST_VISITED_PATH); + const [account] = useOnyx(ONYXKEYS.ACCOUNT, {canBeMissing: true}); + const [session] = useOnyx(ONYXKEYS.SESSION, {canBeMissing: false}); + const [lastRoute] = useOnyx(ONYXKEYS.LAST_ROUTE, {canBeMissing: true}); + const [userMetadata] = useOnyx(ONYXKEYS.USER_METADATA, {canBeMissing: true}); + const [isCheckingPublicRoom] = useOnyx(ONYXKEYS.IS_CHECKING_PUBLIC_ROOM, {initWithStoredValues: false, canBeMissing: false}); + const [updateAvailable] = useOnyx(ONYXKEYS.UPDATE_AVAILABLE, {initWithStoredValues: false, canBeMissing: false}); + const [updateRequired] = useOnyx(ONYXKEYS.UPDATE_REQUIRED, {initWithStoredValues: false, canBeMissing: false}); + const [isSidebarLoaded] = useOnyx(ONYXKEYS.IS_SIDEBAR_LOADED, {canBeMissing: false}); + const [screenShareRequest] = useOnyx(ONYXKEYS.SCREEN_SHARE_REQUEST, {canBeMissing: true}); + const [focusModeNotification] = useOnyx(ONYXKEYS.FOCUS_MODE_NOTIFICATION, {initWithStoredValues: false, canBeMissing: false}); + const [lastVisitedPath] = useOnyx(ONYXKEYS.LAST_VISITED_PATH, {canBeMissing: false}); useDebugShortcut(); From a6b0dfc0fc039a862dc90a61548df4f436471344 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A1bio=20Henriques?= Date: Tue, 15 Apr 2025 00:25:57 +0100 Subject: [PATCH 9/9] Minor typo --- src/Expensify.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Expensify.tsx b/src/Expensify.tsx index 8cc0e6e58693..b3de32221766 100644 --- a/src/Expensify.tsx +++ b/src/Expensify.tsx @@ -53,7 +53,7 @@ Onyx.registerLogger(({level, message, parameters}) => { console.error(message); // useOnyx() calls with "canBeMissing" config set to false will display a visual alert in dev environment - // when they doesn't return data. + // when they don't return data. const shouldShowAlert = typeof parameters === 'object' && !Array.isArray(parameters) && 'showAlert' in parameters && 'key' in parameters; if (Environment.isDevelopment() && shouldShowAlert) { alert(`${message} Key: ${parameters.key as string}`);