Remove Sames
This commit is contained in:
parent
7ed385b45b
commit
7d2c9ab5ce
|
@ -354,6 +354,8 @@ func convertEngineEvent(e engine.Event) (*apitype.UpdateEngineEvent, error) {
|
|||
m := p.Metadata
|
||||
if m.Old != nil && m.New != nil && m.Old.Outputs != nil && m.New.Outputs != nil {
|
||||
changes = m.Old.Outputs.Diff(m.New.Outputs)
|
||||
// Don't send data to the service we won't endup rendering.
|
||||
changes.RemoveSames()
|
||||
}
|
||||
|
||||
updateEvent.ResourceOpFinished = &apitype.ResourceOpFinishedEvent{
|
||||
|
|
|
@ -74,6 +74,29 @@ func (diff *ObjectDiff) Keys() []PropertyKey {
|
|||
return ks
|
||||
}
|
||||
|
||||
// RemoveSames removes all references to "same" property values.
|
||||
func (diff *ObjectDiff) RemoveSames() {
|
||||
removeSamesFromValueDiff := func(vd *ValueDiff) {
|
||||
if arrayDiff := vd.Array; arrayDiff != nil {
|
||||
arrayDiff.Sames = nil
|
||||
for k, v := range arrayDiff.Updates {
|
||||
removeSamesFromValueDiff(&v)
|
||||
}
|
||||
}
|
||||
if objDiff := vd.Object; objDiff != nil {
|
||||
objDiff.Sames = nil
|
||||
for k, v := range objDiff.Updates {
|
||||
removeSamesFromValueDiff(&v)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
diff.Sames = nil
|
||||
for k, v := range diff.Updates {
|
||||
removeSamesFromValueDiff(&v)
|
||||
}
|
||||
}
|
||||
|
||||
// ValueDiff holds the results of diffing two property values.
|
||||
type ValueDiff struct {
|
||||
Old PropertyValue // the old value.
|
||||
|
|
Loading…
Reference in a new issue