prisma / prisma1

💾 Database Tools incl. ORM, Migrations and Admin UI (Postgres, MySQL & MongoDB) [deprecated]
https://v1.prisma.io/docs/
Apache License 2.0
16.56k stars 867 forks source link

updatedFields always returns an empty array #5201

Closed borasumer closed 1 year ago

borasumer commented 2 years ago

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

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 commented 2 years ago

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