Draft Mode
Unanswered
Standard Chinchilla posted this in #help-forum
Standard ChinchillaOP
I'm currently working on a website using NextJs v13.4 and Drupal as a CMS. I want to have Statically rendered pages for a better user experiences. However on the other hand, I want to be able to preview draft pages on Drupal for content editing. I have enabled Draft Mode on the route handlers just fine and I know that when the draft mode cookie is set it automatically turns the page into dynamic rendering.
My problem resides in that I need to send the page resource Version id that I'm intending to preview on Drupal through the route handler to the page.tsx. At first I implemented it by passing it as a query params, so in the route handler I would enable draft mode and redirect to '/whateverpage?resourceVersion=<resourceId>' and on the Page.tsx I would catch that by using Next js searchParams. However by using this I opted out every page from being statically rendered even for the cases that I didn't want to preview anything on Drupal.
From what I've read in previous versions of Nextjs there use to be a previewData({}) function on the handler where you could pass extra data. But it is not the case with the new Draft Mode. Did somebody experience a similar thing and if so, how did you manage to do it ?
My problem resides in that I need to send the page resource Version id that I'm intending to preview on Drupal through the route handler to the page.tsx. At first I implemented it by passing it as a query params, so in the route handler I would enable draft mode and redirect to '/whateverpage?resourceVersion=<resourceId>' and on the Page.tsx I would catch that by using Next js searchParams. However by using this I opted out every page from being statically rendered even for the cases that I didn't want to preview anything on Drupal.
From what I've read in previous versions of Nextjs there use to be a previewData({}) function on the handler where you could pass extra data. But it is not the case with the new Draft Mode. Did somebody experience a similar thing and if so, how did you manage to do it ?