diff --git a/.env.example b/.env.example index cf13ef583016..ecdfc70044e9 100644 --- a/.env.example +++ b/.env.example @@ -11,3 +11,4 @@ USE_WEB_PROXY=false USE_WDYR=false CAPTURE_METRICS=false ONYX_METRICS=false +ONYX_DEBUG_SET_STATE=false diff --git a/README.md b/README.md index 20d4921fc261..c0032837e9a7 100644 --- a/README.md +++ b/README.md @@ -94,7 +94,7 @@ variables referenced here get updated since your local `.env` file is ignored. see [PERFORMANCE.md](contributingGuides/PERFORMANCE.md#performance-metrics-opt-in-on-local-release-builds) for more information - `ONYX_METRICS` (optional) - Set this to `true` to capture even more performance metrics and see them in Flipper see [React-Native-Onyx#benchmarks](https://github.com/Expensify/react-native-onyx#benchmarks) for more information - +- `ONYX_DEBUG_SET_STATE` (options) - Set this to `true` to generate additional logs about which Onyx-connected components are re-rendering and how the data changed ---- # Running the tests diff --git a/package-lock.json b/package-lock.json index 7d6fb1e90e88..88e5a9974c26 100644 --- a/package-lock.json +++ b/package-lock.json @@ -67,7 +67,7 @@ "react-native-image-picker": "^4.8.5", "react-native-image-size": "git+https://github.com/Expensify/react-native-image-size#6b5ab5110dc3ed554f8eafbc38d7d87c17147972", "react-native-modal": "^13.0.0", - "react-native-onyx": "1.0.17", + "react-native-onyx": "1.0.22", "react-native-pdf": "^6.6.2", "react-native-performance": "^2.0.0", "react-native-permissions": "^3.0.1", @@ -24200,6 +24200,11 @@ "integrity": "sha512-xJuoT5+L99XlZ8twedaRf6Ax2TgQVxvgZOYoPKqZufmJib0tL2tegPBOZb1pVNgIhlqDlA0eO0c3wBvQcmzx4w==", "dev": true }, + "node_modules/fast-equals": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/fast-equals/-/fast-equals-4.0.3.tgz", + "integrity": "sha512-G3BSX9cfKttjr+2o1O22tYMLq0DPluZnYtq1rXumE1SpL/F/SLIfHx08WYQoWSIpeMYf8sRbJ8++71+v6Pnxfg==" + }, "node_modules/fast-glob": { "version": "3.2.11", "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.11.tgz", @@ -35515,11 +35520,12 @@ } }, "node_modules/react-native-onyx": { - "version": "1.0.17", - "resolved": "https://registry.npmjs.org/react-native-onyx/-/react-native-onyx-1.0.17.tgz", - "integrity": "sha512-ls2GjURfpBcGnIkwVrg2uuLnTBwd0vrEiUvbMo+GF3k81GAp2flCkVTM7ciAbo155Izk50dm0uXHYq1PIjwTxw==", + "version": "1.0.22", + "resolved": "https://registry.npmjs.org/react-native-onyx/-/react-native-onyx-1.0.22.tgz", + "integrity": "sha512-jg6Y+kc/p9W7NnRXcARrhhDyKemA2gDSYZCsmx5+P7S1nO0fNmGjhBSZULY9r4heEB7xFwQnT+IGgpfwAsUU9A==", "dependencies": { "ascii-table": "0.0.9", + "fast-equals": "^4.0.3", "lodash": "^4.17.21", "underscore": "^1.13.1" }, @@ -61370,6 +61376,11 @@ "integrity": "sha512-xJuoT5+L99XlZ8twedaRf6Ax2TgQVxvgZOYoPKqZufmJib0tL2tegPBOZb1pVNgIhlqDlA0eO0c3wBvQcmzx4w==", "dev": true }, + "fast-equals": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/fast-equals/-/fast-equals-4.0.3.tgz", + "integrity": "sha512-G3BSX9cfKttjr+2o1O22tYMLq0DPluZnYtq1rXumE1SpL/F/SLIfHx08WYQoWSIpeMYf8sRbJ8++71+v6Pnxfg==" + }, "fast-glob": { "version": "3.2.11", "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.11.tgz", @@ -70130,11 +70141,12 @@ } }, "react-native-onyx": { - "version": "1.0.17", - "resolved": "https://registry.npmjs.org/react-native-onyx/-/react-native-onyx-1.0.17.tgz", - "integrity": "sha512-ls2GjURfpBcGnIkwVrg2uuLnTBwd0vrEiUvbMo+GF3k81GAp2flCkVTM7ciAbo155Izk50dm0uXHYq1PIjwTxw==", + "version": "1.0.22", + "resolved": "https://registry.npmjs.org/react-native-onyx/-/react-native-onyx-1.0.22.tgz", + "integrity": "sha512-jg6Y+kc/p9W7NnRXcARrhhDyKemA2gDSYZCsmx5+P7S1nO0fNmGjhBSZULY9r4heEB7xFwQnT+IGgpfwAsUU9A==", "requires": { "ascii-table": "0.0.9", + "fast-equals": "^4.0.3", "lodash": "^4.17.21", "underscore": "^1.13.1" } diff --git a/package.json b/package.json index 60c7d098af77..99ba78ef9d4c 100644 --- a/package.json +++ b/package.json @@ -94,7 +94,7 @@ "react-native-image-picker": "^4.8.5", "react-native-image-size": "git+https://github.com/Expensify/react-native-image-size#6b5ab5110dc3ed554f8eafbc38d7d87c17147972", "react-native-modal": "^13.0.0", - "react-native-onyx": "1.0.17", + "react-native-onyx": "1.0.22", "react-native-pdf": "^6.6.2", "react-native-performance": "^2.0.0", "react-native-permissions": "^3.0.1", diff --git a/src/CONFIG.js b/src/CONFIG.js index 4c03fa63c48e..83177a34b48e 100644 --- a/src/CONFIG.js +++ b/src/CONFIG.js @@ -70,5 +70,6 @@ export default { }, CAPTURE_METRICS: lodashGet(Config, 'CAPTURE_METRICS', 'false') === 'true', ONYX_METRICS: lodashGet(Config, 'ONYX_METRICS', 'false') === 'true', + ONYX_DEBUG_SET_STATE: lodashGet(Config, 'ONYX_DEBUG_SET_STATE', 'false') === 'true', DEV_PORT: process.env.PORT || 8080, }; diff --git a/src/setup/index.js b/src/setup/index.js index b0d2d7687cc8..e122b8d71a04 100644 --- a/src/setup/index.js +++ b/src/setup/index.js @@ -4,6 +4,7 @@ import ONYXKEYS from '../ONYXKEYS'; import CONST from '../CONST'; import platformSetup from './platformSetup'; import * as Metrics from '../libs/Metrics'; +import CONFIG from '../CONFIG'; export default function () { /* @@ -23,6 +24,7 @@ export default function () { keys: ONYXKEYS, safeEvictionKeys: [ONYXKEYS.COLLECTION.REPORT_ACTIONS], captureMetrics: Metrics.canCaptureOnyxMetrics(), + debugSetState: CONFIG.ONYX_DEBUG_SET_STATE, initialKeyStates: { // Clear any loading and error messages so they do not appear on app startup