Issue with LiveQueryProvider in Next.js 14.0.4 and next-sanity@7.0.3 causing an error.

2 replies
Last updated: Dec 12, 2023
Hi folks, I have an issue with the
LiveQueryProvider
in latest Next.js 14.0.4 with
next-sanity@7.0.3
. If I comment out the Provider everything works fine but with the Provider enabled I get the following error message

Error: Element type is invalid. Received a promise that resolves to: [object Object]. Lazy element type must resolve to a class or function. Did you wrap a component in React.lazy() more than once?
Does anyone else have the same issue?
Dec 12, 2023, 9:32 AM
Got it,
@sanity/preview-kit
already wraps the
LiveQueryProvider
in a lazy import. So importing the component without
dynamic
works.
Dec 12, 2023, 9:36 AM
Thanks 🙏
Dec 12, 2023, 12:39 PM

Sanity – Build the way you think, not the way your CMS thinks

Sanity is the developer-first content operating system that gives you complete control. Schema-as-code, GROQ queries, and real-time APIs mean no more workarounds or waiting for deployments. Free to start, scale as you grow.

Was this answer helpful?