Skip to content

Commit

Permalink
add back in context helpers to example
Browse files Browse the repository at this point in the history
  • Loading branch information
phughes-scwx committed Nov 22, 2024
1 parent 8ddecbd commit 8d19c54
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions _examples/selection/selection.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,18 +39,17 @@ func (r *queryResolver) Events(ctx context.Context) ([]Event, error) {

var events []Event
for i := 0; i < 10; i++ {
resCtx := graphql.GetFieldContext(ctx)
if i%2 == 0 {
events = append(events, &Like{
Selection: sels,
Collected: formatCollected(graphql.CollectFields(opCtx, resCtx.Field.Selections, []string{"Like"})),
Collected: formatCollected(graphql.CollectFieldsCtx(ctx, []string{"Like"})),
Reaction: ":=)",
Sent: time.Now(),
})
} else {
events = append(events, &Post{
Selection: sels,
Collected: formatCollected(graphql.CollectFields(opCtx, resCtx.Field.Selections, []string{"Post"})),
Collected: formatCollected(graphql.CollectFieldsCtx(ctx, []string{"Post"})),
Message: "Hey",
Sent: time.Now(),
})
Expand Down

0 comments on commit 8d19c54

Please sign in to comment.