draftMode with cacheComponents
Unanswered
Giant wood wasp posted this in #help-forum
Giant wood waspOP
Honestly, what is the 'right way' to work with draft mode when you're using cacheComponents?
I want my page to be fully cached for my 99.99999% of users but I want to use draftMode for my editors. How am I meanto to do this with recreating my whole application in a draftMode only route folder?
I want my page to be fully cached for my 99.99999% of users but I want to use draftMode for my editors. How am I meanto to do this with recreating my whole application in a draftMode only route folder?
5 Replies
Sun bear
have a separate route /draft/[[...pages]]
this way pages on /[[...pages]] are fully cached and anyone on /draft route sees the dynamic content and is redirected if he has no access to draft
Giant wood waspOP
This means recreating all my routes there though doesn't it? This is what I wanted to avoid
Sun bear
yes you would have to have some "duplicate" logic here but that's the only way if you want to serve those pages as static components
Giant wood waspOP
This feels like such a downgrade from a DX point of view. In the past checking draftMode was something which wouldn't affect whether a page was dynamic... in all honesty it really shouldn't be. The whole 'composition' argument really falls down for cache components for me here.