prisma1 icon indicating copy to clipboard operation
prisma1 copied to clipboard

updatedFields always returns an empty array

Open borasumer opened this issue 3 years ago • 1 comments

I have a subscription that returns the default prisma payload which is:

type Payload{
  mutation: MutationType!
  node: Node
  updatedFields: [String!]
  previousValues: NodePreviousValues
}

But for some reason updatedFields is always an empty array:

{
  "data": {
    "userCheckedInSub": {
      "mutation": "UPDATED",
      "previousValues": {
        "id": "randomId",
        "updatedAt": "2022-04-28T16:31:31.370Z",
        "createdAt": "2022-04-28T16:31:31.370Z"
      },
      "updatedFields": [],
      "node": {
        "id": "randomId"
      }
    }
  }
}

and this is my subscription in the server:

  userCheckedInSub: {
    subscribe: async (parent, args, ctx, info) => {
      const sub = await ctx.prisma.subscription.hourShift(
        {
          where: args.where,
        },
        info,
      );
      return (
        ctx.prisma.subscription.hourShift(
          {
            where: args.where,
          },
          info,
        )
      );
    },
    resolve: (payload, args, context, info) => {
      return payload;
    },
  },

Expected behavior It should return the updated fields when there is an update to the subscribed node

  • Connector: [e.g. Postgres] -Prisma CLI version: prisma/1.34.0 (darwin-x64) node-v10.4.1 -Prisma server version: 1.34.10
  • OS: [ OS X High Sierra]
  • other dependencies: prisma-binding

So not sure either I am missing something in my setup, or that is an actual bug. And I'd like to know if there is a way to get the mutation data in the subscription resolver, I can use that to send a custom payload, based on the updated fields.

borasumer avatar Apr 28 '22 17:04 borasumer

No body is maintaining this anymore? That's sad.

borasumer avatar May 11 '22 18:05 borasumer