Closed brifiction closed 9 months ago
FYI, I've managed to figure out the issue. For latest nextjs
, we need to declare 'use client' etc for web pages rendering. Now, in the spotlight template, we don't have these declared yet, as well as async
pages are not allowed.
Thus, the way you load & render (for example) articles
(AKA the MDX pages), will have to "comply" with the nextjs
changes and guidelines in serving 'client' versus 'server', and more.
Issue resolved, as the solution is to refactor everything, according to nextjs
14.x (and beyond).
Edit: FYI, I was wrong about not finding 'use client' declarations in this issue, finally found declared 'use client' in relevant client components - all good there. Now, managed to narrow down the reported issue to MDX handling & render methods., figured out the template's issues from these latest findings
@brifiction Hey! Glad you got this figured out, but I am curious, when did you happen to download the Spotlight template from the Tailwind UI website? I ask only because last week we actually published an updated version of this template that is now on Next.js v14.
When I try to follow the steps above I am not able to reproduce this issue.
Basically just want to make sure there isn't anything still broken in this template 👍
@reinink Thank you for following up. To answer your questions, replying for each sentence:
/articles
on render (same issue & screenshot as original post above).No worries, as I do love the work put into a template like Spotlight, especially the scroll effects & transition usage.
But yeah, still wrestling with the MDX render issues, for example simply loading /articles
route or directly rendering "an article", still returns MDX render issues.
Please note, I did not upgrade dependency versions after the template pull, to establish a baseline on resolving the issues found.
If it helps, when I quote "still returns MDX render issues" it is mostly relevant to:
getArticles
- The implemented way of getArticles
async function, this needs to be improved (I reckon). To support this, I removed snippets of code bit by bit, and managed to successfully load "an article" page as "article layout without the MDX content".fs
related issues (see Screenshots (additional) section below).metadata
exports and async pages, along with applying the new defined "use client"
at top for front-end, are to be factored in for (possible) refactoring. In meantime, I'll apply my own complete customisation from spotlight initial template, such as adding new dependencies & refactoring affected areas of rendering MDX. Also shoutout to the authors who worked on Syntax template, the way of rendering MDX with MDX plugins in that template is sublime - thus, I am attempting to replicate Syntax into Spotlight template.
Thanks again for looking into this issue, I look forward to your findings & new template releases as always!
What component (if applicable)
Describe the bug After installing all dependencies for the
spotlight
template, I've encountered an error below - and I am unable to narrow down, if it is the MDX configurations with the provided custom plugins, or a NextJS problem.For more information, I've provided the versioning details below:
And the
next.config.mjs
file (it's the default config from template):To Reproduce Steps to reproduce the behavior:
pnpm i
.pnpm dev
to load NextJS web app.Expected behavior The expected behaviour is to have any and all MDX pages loaded & rendered, successfully.
Screenshots
Browser/Device (if applicable) N/A
Additional context None.