react-native-onyx 3.0.76 → 3.0.77

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -58,27 +58,15 @@ function degradePerformance(error) {
58
58
  * Runs a piece of code and degrades performance if certain errors are thrown
59
59
  */
60
60
  function tryOrDegradePerformance(fn, waitForInitialization = true) {
61
- return new Promise((resolve, reject) => {
62
- const promise = waitForInitialization ? initPromise : Promise.resolve();
63
- promise.then(() => {
64
- try {
65
- resolve(fn());
66
- }
67
- catch (error) {
68
- // Test for known critical errors that the storage provider throws, e.g. when storage is full
69
- if (error instanceof Error) {
70
- // IndexedDB error when storage is full (https://github.com/Expensify/App/issues/29403)
71
- if (error.message.includes('Internal error opening backing store for indexedDB.open')) {
72
- degradePerformance(error);
73
- }
74
- // catch the error if DB connection can not be established/DB can not be created
75
- if (error.message.includes('IDBKeyVal store could not be created')) {
76
- degradePerformance(error);
77
- }
78
- }
79
- reject(error);
80
- }
81
- });
61
+ const initialization = waitForInitialization ? initPromise : Promise.resolve();
62
+ return initialization
63
+ .then(() => fn())
64
+ .catch((error) => {
65
+ // catch the error if DB connection can not be established/DB can not be created
66
+ if (error instanceof Error && error.message.includes('IDBKeyVal store could not be created')) {
67
+ degradePerformance(error);
68
+ }
69
+ return Promise.reject(error);
82
70
  });
83
71
  }
84
72
  const storage = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-onyx",
3
- "version": "3.0.76",
3
+ "version": "3.0.77",
4
4
  "author": "Expensify, Inc.",
5
5
  "homepage": "https://expensify.com",
6
6
  "description": "State management for React Native",