react-native-onyx 3.0.90 → 3.0.91
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.
|
@@ -150,10 +150,17 @@ const provider = {
|
|
|
150
150
|
if (!provider.store) {
|
|
151
151
|
throw new Error('Store is not initialized!');
|
|
152
152
|
}
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
153
|
+
// Aggregate the whole table into a single JSON string in SQLite so we only run JSON.parse
|
|
154
|
+
// once, instead of returning every row and parsing each one individually in JavaScript.
|
|
155
|
+
return provider.store
|
|
156
|
+
.executeAsync('SELECT json_group_array(json_array(record_key, json(valueJSON))) AS aggregated FROM keyvaluepairs;')
|
|
157
|
+
.then(({ rows }) => {
|
|
158
|
+
var _a;
|
|
159
|
+
const aggregated = (_a = rows === null || rows === void 0 ? void 0 : rows.item(0)) === null || _a === void 0 ? void 0 : _a.aggregated;
|
|
160
|
+
if (aggregated == null) {
|
|
161
|
+
return [];
|
|
162
|
+
}
|
|
163
|
+
return JSON.parse(aggregated);
|
|
157
164
|
});
|
|
158
165
|
},
|
|
159
166
|
removeItem(key) {
|