@zauru-sdk/hooks 6.2.6 → 6.3.0
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.
- package/dist/esm/catalogs.js +19 -9
- package/package.json +3 -3
package/dist/esm/catalogs.js
CHANGED
|
@@ -148,15 +148,25 @@ function useGetReduxCatalog(CATALOG_NAME, { online = false, staleWhileRevalidate
|
|
|
148
148
|
// Caso: la respuesta sí es data real
|
|
149
149
|
const newData = possibleData[CATALOG_NAME];
|
|
150
150
|
if (Array.isArray(newData)) {
|
|
151
|
-
//
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
}
|
|
151
|
+
// A successful empty list must not wipe a catalog that was already
|
|
152
|
+
// cached (timeouts/partial responses often arrive as []).
|
|
153
|
+
if (newData.length === 0 && hasLocalData) {
|
|
154
|
+
console.log("La respuesta vino vacía pero hay datos locales en la consulta de", CATALOG_NAME);
|
|
155
|
+
setData({
|
|
156
|
+
data: catalogData?.data || [],
|
|
157
|
+
loading: false,
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
else {
|
|
161
|
+
dispatch((0, redux_1.catalogsFetchSuccess)({
|
|
162
|
+
name: CATALOG_NAME,
|
|
163
|
+
data: newData,
|
|
164
|
+
}));
|
|
165
|
+
setData({
|
|
166
|
+
data: newData,
|
|
167
|
+
loading: false,
|
|
168
|
+
});
|
|
169
|
+
}
|
|
160
170
|
}
|
|
161
171
|
else {
|
|
162
172
|
// Por alguna razón no llegó el array esperado
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zauru-sdk/hooks",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.3.0",
|
|
4
4
|
"description": "Hooks reutilizables dentro de las webapps de Zauru.",
|
|
5
5
|
"main": "./dist/esm/index.js",
|
|
6
6
|
"module": "./dist/esm/index.js",
|
|
@@ -29,10 +29,10 @@
|
|
|
29
29
|
"@remix-run/react": "^2.8.1",
|
|
30
30
|
"@zauru-sdk/common": "^6.2.4",
|
|
31
31
|
"@zauru-sdk/icons": "^6.0.0",
|
|
32
|
-
"@zauru-sdk/redux": "^6.
|
|
32
|
+
"@zauru-sdk/redux": "^6.5.0",
|
|
33
33
|
"@zauru-sdk/types": "^6.7.0",
|
|
34
34
|
"react": "^18.2.0",
|
|
35
35
|
"react-dom": "^18.2.0"
|
|
36
36
|
},
|
|
37
|
-
"gitHead": "
|
|
37
|
+
"gitHead": "4582fe6280d32113461687a5e1b23419be343798"
|
|
38
38
|
}
|