@innertia-solutions/innertia-nuxt 0.1.31 → 0.1.32

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.
@@ -211,6 +211,41 @@ const fetchInitial = async () => {
211
211
  }
212
212
  }
213
213
 
214
+ /**
215
+ * Refresca el árbol PRESERVANDO la expansión actual: re-fetchea los roots y los
216
+ * hijos de cada nodo expandido (datos frescos, sin colapsar ni resetear scroll).
217
+ * Útil tras mutar un nodo (ej. marcar revisado) sin remontar el componente.
218
+ */
219
+ const reload = async () => {
220
+ loading.value = true
221
+ isFetching.value = true
222
+ isDataFromCache.value = false
223
+ try {
224
+ const res = await api.post(props.endpoint, buildBody())
225
+ roots.value = res?.data ?? []
226
+ meta.value = res?.meta ?? null
227
+
228
+ const expanded = [...expandedSet.value]
229
+ const fresh = {}
230
+ await Promise.all(expanded.map(async (nodeId) => {
231
+ try {
232
+ const r = await api.post(props.endpoint, buildBody({ expand: nodeId }))
233
+ fresh[nodeId] = r?.data ?? []
234
+ } catch {
235
+ fresh[nodeId] = childrenById.value[nodeId] ?? []
236
+ }
237
+ }))
238
+ childrenById.value = fresh
239
+ if (props.cached) saveToCache()
240
+ emit('loaded', res)
241
+ } catch (e) {
242
+ console.error('[Tree.Standard] reload failed:', e)
243
+ } finally {
244
+ loading.value = false
245
+ isFetching.value = false
246
+ }
247
+ }
248
+
214
249
  // ─── Cache ────────────────────────────────────────────────────────────────────
215
250
  const cacheKey = computed(() => {
216
251
  if (!props.cached || !props.name) return null
@@ -527,6 +562,7 @@ onBeforeUnmount(() => {
527
562
 
528
563
  defineExpose({
529
564
  refresh: fetchInitial,
565
+ reload, // refresca preservando expansión (sin colapsar)
530
566
  clearChecked,
531
567
  getChecked: () => [...checkedSet.value],
532
568
  })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@innertia-solutions/innertia-nuxt",
3
- "version": "0.1.31",
3
+ "version": "0.1.32",
4
4
  "description": "Innertia Solutions — Nuxt layer unificada: core, auth, multitenancy, theme y app contexts",
5
5
  "keywords": [
6
6
  "nuxt",