We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 7a55685 commit fa2778aCopy full SHA for fa2778a
packages/nuxt/src/runtime/payload-plugin.ts
@@ -29,4 +29,25 @@ export default definePayloadPlugin(() => {
29
30
return parsed
31
})
32
+ // to handle the `id` non-enumerable property
33
+ definePayloadReducer(
34
+ 'DocumentData',
35
+ (data: any) =>
36
+ data &&
37
+ typeof data === 'object' &&
38
+ 'id' in data &&
39
+ JSON.stringify({
40
+ id: data.id,
41
+ ...data,
42
+ })
43
+ )
44
+ definePayloadReviver('DocumentData', (data: string) => {
45
+ const parsed = JSON.parse(data)
46
+ // preserve the non-enumerable property
47
+ // we need to delete it first
48
+ delete parsed.id
49
+ return Object.defineProperty(parsed, 'id', {
50
+ value: parsed.id,
51
52
53
0 commit comments