next-payload - incompatibility with Mantine?

default discord avatar
johnrisby
last month

Hi all, new to PayloadCMS. Set it up yesterday, had a play, liked it. Today I was going to start pulling data into my next.js app (next 13 but old style, not using src etc) and stumbled upon next-payload and the concept of putting Payload into my app and using the local API. But ... not really working out for me 😉



Firstly, it installed it under src - although from what I can gather this is a new addition last week and should detect if I'm using the new style - which I'm not - and only then install it like that?



So I manually moved things around (which I'm not ruling out as part of the problem btw).



After a lot of messing around, and moving the changes I'd made to my Payload setup into my next.js app, I can get it basically working but not if I use the MantineProvider (using Mantine v6 btw) which includes the theme... if I remove that from my AppShell it works (but... that's not an option). If I put it back, I get this error:



"Server Error


TypeError: Cannot read properties of null (reading 'useContext')



I'm already removing the AppShell/Mantine etc from /admin - so Payload isn't having these problems with Mantine, but it's the other way around - on a normal part of my site, something is clashing.



Does anyone have any thoughts please? If there's some way to decouple Payload from the non-admin part of my site, that'd be good maybe?



As things stand, I'm going to have to go back to two separation apps - which isn't the end of the world at all- but frustrating that I've spent all afternoon trying this and can't get it to work (especially as it may well be something I'm doing/not doing that I should).



The Payload I copied over was originally installed yesterday via npx and using the base template of the demo.



Thanks



Solved it ... 😦 After going through everything ... it was the last thing I tried (ha, imagine!)



I updated lots of packages, removed lots that weren't being used etc etc.



Finally... updating next.js itself... from 13.2.3 to 13.4.12 fixed it. Doh.



Leaving this up for anyone else in the same (stupid 😉 position!



Still, at least the project is now a lot tidier too 😉

    Open the post
    Continue the discussion in Discord
    Like what we're doing?
    Star us on GitHub!

    Star

    Connect with the Payload Community on Discord

    Discord

    online

    Can't find what you're looking for?

    Get help straight from the Payload team with an Enterprise License.