plasmic
plasmic copied to clipboard
[Next.js] PlasmicRootProvider globalVariants Typing Issue
Hi!
I tried to enable localization and followed the documentation.
Code
<PlasmicRootProvider
loader={PLASMIC}
prefetchedData={plasmicData}
prefetchedQueryData={queryCache}
globalVariants={{ locale }}
>
Output:
Type '{ locale: string; }' is not assignable to type 'GlobalVariantSpec[]'.
Object literal may only specify known properties, and 'locale' does not exist in type 'GlobalVariantSpec[].'
That does appear to be a typo.... In the meantime, can you try this?
globalVariants={[{name: 'locale', value: locale}]}
Global variants need to be specified in an array as described here: https://docs.plasmic.app/learn/other-assets/#global-variants
Please let me know if this solves it for you?
Hi @ryscheng,
Thanks for your response. I already tried it before raising this issue, and unfortunately not working.
Plasmic Studio Configuration
Code
globalVariants={[{ name: 'locale', value: locale }]}
Can you message the project URL to us via the in-app chat feature? We can take a look on your specific project there. Thanks!
I am having the same issue. In Plasmic studio preview it works but when running the localhost/remote site it doesn't. Maybe something is left out of the bundle?
@code0wl Followed up with you on Slack!
I had the same issue and solve it with capital L globalVariants={[{ name: 'Locale', value: router.locale }]}
@MuratOzdemir-dev thanks for your hint, it helped for me! 🚀