Skip to content

Commit a2394be

Browse files
committed
fix: dedup batch bug, sort widgetsPropKeys, mock panic, remove no-op clone call
1 parent 10f460d commit a2394be

4 files changed

Lines changed: 10 additions & 10 deletions

File tree

mdl/backend/mock/mock_microflow.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ func (m *MockBackend) ParseMicroflowFromRaw(raw map[string]any, unitID, containe
5353
if m.ParseMicroflowFromRawFunc != nil {
5454
return m.ParseMicroflowFromRawFunc(raw, unitID, containerID)
5555
}
56-
return nil
56+
panic("mock ParseMicroflowFromRaw called but ParseMicroflowFromRawFunc is not set")
5757
}
5858

5959
func (m *MockBackend) ListNanoflows() ([]*microflows.Nanoflow, error) {

mdl/backend/mpr/widget_builder.go

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -269,14 +269,8 @@ func (ob *mprWidgetObjectBuilder) CloneGallerySelectionProperty(propertyKey stri
269269
return
270270
}
271271

272-
ob.object = updateWidgetPropertyValue(ob.object, ob.propertyTypeIDs, propertyKey, func(val bson.D) bson.D {
273-
// The val here is the WidgetValue — but we need the WidgetProperty level.
274-
// CloneGallerySelectionProperty works on the Properties array directly.
275-
return val
276-
})
277-
278-
// Actually need to work at the Properties array level: find the property,
279-
// clone it with new IDs and updated Selection, then append.
272+
// Work at the Properties array level: find the property, clone it with new
273+
// IDs and updated Selection, then append.
280274
result := make(bson.D, 0, len(ob.object))
281275
for _, elem := range ob.object {
282276
if elem.Key == "Properties" {

mdl/backend/mpr/workflow_mutator.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -714,7 +714,11 @@ func collectNamesRecursive(flow bson.D, names map[string]bool) {
714714
// deduplicateNewActivityName ensures a new activity name doesn't conflict.
715715
func deduplicateNewActivityName(act workflows.WorkflowActivity, existingNames map[string]bool) {
716716
name := act.GetName()
717-
if name == "" || !existingNames[name] {
717+
if name == "" {
718+
return
719+
}
720+
if !existingNames[name] {
721+
existingNames[name] = true
718722
return
719723
}
720724
for i := 2; i < 1000; i++ {

mdl/executor/widget_engine.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ package executor
44

55
import (
66
"fmt"
7+
"sort"
78
"strings"
89

910
"github.com/mendixlabs/mxcli/mdl/ast"
@@ -173,6 +174,7 @@ func (e *PluggableWidgetEngine) Build(def *WidgetDefinition, w *ast.WidgetV3) (*
173174
widgetsPropKeys = append(widgetsPropKeys, propKey)
174175
}
175176
}
177+
sort.Strings(widgetsPropKeys)
176178
// Phase 1: Named matching — match children by name against property keys
177179
matchedChildren := make(map[int]bool)
178180
for _, propKey := range widgetsPropKeys {

0 commit comments

Comments
 (0)