Simplify your stack and build anything. Or everything.
Build tomorrow’s web with a modern solution you truly own.
Code-based nature means you can build on top of it to power anything.
It’s time to take back your content infrastructure.

globalType not included in doc

default discord avatar
manny_49461last year

Hey there, I'm trying to set up an afterChange hook to revalidate globals when they're updated. I used the same logic used to revalidate a Pages collection I've set up which is working, but when I console.log(doc) I noticed that globalType is not included, which is what I was going to use via RevalidateTag to revalidate. I see in the API tab that globalType is there, why would it not be included in doc? I'm using next-payload.



This is what I see when I console.log(doc):



{


id: 1,


navItems: [


{


_order: 1,


id: '65330bb01c32b17fdf32cbf7',


link_type: 'reference',


link_newTab: null,


link_url: null,


link_label: 'Homyyy',


link: [Object]


},


{


_order: 2,


id: '65330784435e944854258af6',


link_type: 'reference',


link_newTab: false,


link_url: null,


link_label: 'About',


link: [Object]


},


{


_order: 3,


id: '653308c9435e944854258af8',


link_type: 'reference',


link_newTab: null,


link_url: null,


link_label: 'Solutions',


link: [Object]


},


{


_order: 4,


id: '65330bf31c32b17fdf32cbf9',


link_type: 'reference',


link_newTab: null,


link_url: null,


link_label: 'News',


link: [Object]


},


{


_order: 5,


id: '65330bfb1c32b17fdf32cbfb',


link_type: 'reference',


link_newTab: null,


link_url: null,


link_label: 'Contact',


link: [Object]


}


],


updatedAt: '2023-10-22T19:33:41.164Z',


createdAt: null


}



I tested with an additional footer global and am getting the same issue, and for some reason the id for both header and footer is 1?



For some reason globalType started showing now out of nowhere

    Star on GitHub

    Star

    Chat on Discord

    Discord

    online

    Can't find what you're looking for?

    Get dedicated engineering support directly from the Payload team.