@@ -8,9 +8,11 @@ import (
88 "context"
99 "encoding/json"
1010 "fmt"
11+ "maps"
1112 "os"
1213 "path/filepath"
1314 "reflect"
15+ "slices"
1416
1517 "github.com/BurntSushi/toml"
1618 "github.com/claceio/clace/internal/app/appfs"
@@ -336,8 +338,25 @@ func (s *Server) Apply(ctx context.Context, applyPath string, appPathGlob string
336338 }
337339 }
338340
341+ // Get list of all updated apps
342+ allUpdatedApps := []types.AppPathDomain {}
343+ allUpdatedApps = append (allUpdatedApps , updateResults ... )
344+ allUpdatedApps = append (allUpdatedApps , reloadResults ... )
345+ allUpdatedApps = append (allUpdatedApps , promoteResults ... )
346+ for _ , app := range approveResults {
347+ allUpdatedApps = append (allUpdatedApps , app .AppPathDomain )
348+ }
349+ for _ , app := range createResults {
350+ allUpdatedApps = append (allUpdatedApps , app .AppPathDomain )
351+ }
352+ allAppMap := make (map [types.AppPathDomain ]bool )
353+ for _ , app := range allUpdatedApps {
354+ allAppMap [app ] = true
355+ }
356+ allUpdatedApps = slices .Collect (maps .Keys (allAppMap ))
357+
339358 // Commit the transaction if not dry run and update the in memory app store
340- if err := s .CompleteTransaction (ctx , tx , updateResults , dryRun , "apply" ); err != nil {
359+ if err := s .CompleteTransaction (ctx , tx , allUpdatedApps , dryRun , "apply" ); err != nil {
341360 return nil , err
342361 }
343362
0 commit comments