From 5d3ae0c0f4717b89155e824cf7878eb47c354b2b Mon Sep 17 00:00:00 2001 From: Shadowfaxenator Date: Sun, 13 Oct 2024 21:32:51 +0900 Subject: [PATCH] Update response.go --- response.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/response.go b/response.go index fc79b1c..1e9198b 100644 --- a/response.go +++ b/response.go @@ -211,7 +211,7 @@ func (i *Inertia) prepareProps(r *http.Request, component string, props Props) ( wg:=new(sync.WaitGroup) errch:=make(chan error,len(result)) - defer close(errch) + for key, val := range result { wg.Add(1) go func(){ @@ -228,14 +228,15 @@ func (i *Inertia) prepareProps(r *http.Request, component string, props Props) ( } wg.Wait() + close(errch) allerr:=make([]error,len(result)) - for _, e:= range errch { + for e:= range errch { allerr= append(allerr,e) } err:=errors.Join(allerr...) if err!=nil{ - return nil, result + return nil, err } return result, nil }