Solución del login colgado
Some checks failed
/ Deploy to Cloudflare Pages (push) Has been cancelled
Some checks failed
/ Deploy to Cloudflare Pages (push) Has been cancelled
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import { create } from 'zustand'
|
||||
import { supabase } from '@/lib/supabase'
|
||||
import { supabaseProcessRepo } from '@/persistence/supabase/process-repo'
|
||||
import { supabaseActivityRepo } from '@/persistence/supabase/activity-repo'
|
||||
import { supabaseGatewayRepo } from '@/persistence/supabase/gateway-repo'
|
||||
@@ -35,6 +36,8 @@ export const useProcessStore = create<ProcessState>((set, get) => ({
|
||||
loadProcess: async (processId) => {
|
||||
set({ isLoading: true, error: null })
|
||||
try {
|
||||
// Barrera única: garantiza sesión restaurada antes del fan-out en paralelo
|
||||
await supabase.auth.getSession()
|
||||
const [process, activities, gateways, resources] = await Promise.all([
|
||||
supabaseProcessRepo.getById(processId),
|
||||
supabaseActivityRepo.getByProcess(processId),
|
||||
@@ -50,6 +53,7 @@ export const useProcessStore = create<ProcessState>((set, get) => ({
|
||||
|
||||
setCurrentProcess: async (process, userId) => {
|
||||
await supabaseProcessRepo.save(process, userId)
|
||||
await supabase.auth.getSession()
|
||||
const [activities, gateways, resources] = await Promise.all([
|
||||
supabaseActivityRepo.getByProcess(process.id),
|
||||
supabaseGatewayRepo.getByProcess(process.id),
|
||||
|
||||
Reference in New Issue
Block a user