Currently, I am working on a Nuxt.js application set to universal mode and deployed as a static website using nuxt generate
. The app is pulling data from a GraphQL API linked to a CMS, and everything is functioning properly. Whenever content is updated in the CMS, a deployment script triggers nuxt generate
, and the changes reflect on the website within seconds.
The issue I'm facing is related to the live preview feature of the CMS (Craft CMS) accessible during content editing. The preview window sends a token to the app, allowing it to adjust its query based on the token value. This functionality seems to work fine in spa mode but not in universal mode. In universal mode, the query has already been executed on the server during generation of static files.
I have attempted various approaches with a serverMiddleware inspired by the example provided here. I also forked the code sandbox and tried different logics inside the serverMiddleware function, but unfortunately, no results have been achieved so far.