diff --git a/internal/core/factory.go b/internal/core/factory.go index 4f0273f9c..1163317c1 100644 --- a/internal/core/factory.go +++ b/internal/core/factory.go @@ -70,11 +70,7 @@ func (f *Factory) NewBasis(resourceId string, opts ...BasisOption) (*Basis, erro } opts = append(opts, - WithClient(f.client), WithFactory(f), - WithLogger(f.logger), - WithUI(f.ui), - WithPluginManager(f.plugins), ) b, err := NewBasis(f.ctx, opts...) @@ -82,6 +78,20 @@ func (f *Factory) NewBasis(resourceId string, opts ...BasisOption) (*Basis, erro return nil, err } + // Set any unset values which we can provide + if b.client == nil { + b.client = f.client + } + if b.logger == nil { + b.logger = f.logger + } + if b.ui == nil { + b.ui = f.ui + } + if b.plugins == nil { + b.plugins = f.plugins + } + // Now that we have the basis information loaded, check if // we have a cached version and return that if so if existingB, ok := f.cache.Fetch(b.basis.ResourceId); ok {