Skip to content

Commit 57fcd92

Browse files
author
parasssh
authored
change behavior of param cascade to allow parent's cascade (with or w/o param) to trickle to child until overridden explicitly (#6283)
1 parent 52e136f commit 57fcd92

File tree

2 files changed

+24
-14
lines changed

2 files changed

+24
-14
lines changed

query/query.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -553,9 +553,9 @@ func treeCopy(gq *gql.GraphQuery, sg *SubGraph) error {
553553
IsInternal: gchild.IsInternal,
554554
}
555555

556-
// If parent has @cascade (with or without params), inherit @cascade (with no params)
556+
// Inherit from the parent.
557557
if len(sg.Params.Cascade) > 0 {
558-
args.Cascade = append(args.Cascade, "__all__")
558+
args.Cascade = append(args.Cascade, sg.Params.Cascade...)
559559
}
560560
// Allow over-riding at this level.
561561
if len(gchild.Cascade) > 0 {

systest/queries_test.go

Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1147,18 +1147,28 @@ func CascadeParams(t *testing.T, c *dgo.Dgraph) {
11471147
out: `
11481148
{
11491149
"q": [
1150-
{
1151-
"name": "Alice 1",
1152-
"age": "23"
1153-
},
1154-
{
1155-
"name": "Alice 2"
1156-
},
1157-
{
1158-
"name": "Alice 3",
1159-
"age": "32"
1160-
}
1161-
]
1150+
{
1151+
"name": "Alice 1",
1152+
"age": "23",
1153+
"friend": [
1154+
{
1155+
"name": "Bob"
1156+
}
1157+
]
1158+
},
1159+
{
1160+
"name": "Alice 2",
1161+
"friend": [
1162+
{
1163+
"name": "Chris"
1164+
}
1165+
]
1166+
},
1167+
{
1168+
"name": "Alice 3",
1169+
"age": "32"
1170+
}
1171+
]
11621172
}
11631173
`,
11641174
},

0 commit comments

Comments
 (0)