@innertia-solutions/innertia-nuxt 0.1.75 → 0.1.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.
|
@@ -79,6 +79,26 @@ onMounted(() => {
|
|
|
79
79
|
initHsSelect()
|
|
80
80
|
})
|
|
81
81
|
|
|
82
|
+
/**
|
|
83
|
+
* Si las options llegan o cambian después del mount (query async), HSSelect ya
|
|
84
|
+
* construyó su dropdown con las viejas (vacío) y no se entera. Se destruye y se
|
|
85
|
+
* vuelve a inicializar con las nuevas, conservando el valor seleccionado.
|
|
86
|
+
*/
|
|
87
|
+
watch(
|
|
88
|
+
() => (props.options ?? []).map((o: any) => `${o.value}::${o.label}::${o.disabled ? 1 : 0}`).join('|'),
|
|
89
|
+
async () => {
|
|
90
|
+
const el = selectRef.value
|
|
91
|
+
const HSSelect = (window as any).HSSelect
|
|
92
|
+
if (!el || !HSSelect) return
|
|
93
|
+
try {
|
|
94
|
+
HSSelect.getInstance?.(el)?.destroy?.()
|
|
95
|
+
} catch (e) {
|
|
96
|
+
console.warn('[FormsSelect] HSSelect destroy falló:', e)
|
|
97
|
+
}
|
|
98
|
+
await initHsSelect()
|
|
99
|
+
},
|
|
100
|
+
)
|
|
101
|
+
|
|
82
102
|
const handleChange = (e: Event) => {
|
|
83
103
|
const val = (e.target as HTMLSelectElement).value
|
|
84
104
|
emit('update:modelValue', val || null)
|
package/package.json
CHANGED
package/stores/organization.ts
CHANGED
|
@@ -12,7 +12,7 @@ import { defineStore } from 'pinia'
|
|
|
12
12
|
* Org shape: { id, key (slug), name }
|
|
13
13
|
*
|
|
14
14
|
* Persistencia:
|
|
15
|
-
* - `currentByContext` en cookie 'innertia_org_by_ctx' (30d, SSR-leíble)
|
|
15
|
+
* - `currentByContext` + `consolidated` en cookie 'innertia_org_by_ctx' (30d, SSR-leíble)
|
|
16
16
|
* - `available` NO se persiste — viene fresco de auth/me en cada boot
|
|
17
17
|
*/
|
|
18
18
|
export const useOrganizationStore = defineStore('organization', {
|
|
@@ -28,7 +28,9 @@ export const useOrganizationStore = defineStore('organization', {
|
|
|
28
28
|
persist: [
|
|
29
29
|
{
|
|
30
30
|
key: 'innertia_org_by_ctx',
|
|
31
|
-
|
|
31
|
+
// `consolidated` también: la vista comunal/consolidada elegida debe sobrevivir a la recarga
|
|
32
|
+
// (el backend igual valida X-Consolidated con los permisos del usuario).
|
|
33
|
+
pick: ['currentByContext', 'consolidated'],
|
|
32
34
|
// pinia-plugin-persistedstate v4: `cookies(...)` es una fábrica que recibe las
|
|
33
35
|
// opciones. Pasarla sin llamar (API v3 + `cookieOptions`) deja un storage inválido
|
|
34
36
|
// y la sede elegida nunca se guarda: cada recarga vuelve al selector de sede.
|