plasmic icon indicating copy to clipboard operation
plasmic copied to clipboard

[Next.js] PlasmicRootProvider globalVariants Typing Issue

Open buraksakalli opened this issue 3 years ago • 6 comments
trafficstars

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[].'

buraksakalli avatar Jun 16 '22 11:06 buraksakalli

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

ryscheng avatar Jun 16 '22 17:06 ryscheng

Please let me know if this solves it for you?

ryscheng avatar Jun 16 '22 17:06 ryscheng

Hi @ryscheng,

Thanks for your response. I already tried it before raising this issue, and unfortunately not working.

Plasmic Studio Configuration

Screen Shot 2022-06-16 at 9 42 54 PM

Code

globalVariants={[{ name: 'locale', value: locale }]}

buraksakalli avatar Jun 16 '22 17:06 buraksakalli

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!

ryscheng avatar Jun 20 '22 23:06 ryscheng

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 avatar Jul 13 '22 06:07 code0wl

@code0wl Followed up with you on Slack!

yang avatar Jul 13 '22 18:07 yang

I had the same issue and solve it with capital L globalVariants={[{ name: 'Locale', value: router.locale }]}

MuratOzdemir-dev avatar Feb 27 '23 13:02 MuratOzdemir-dev

@MuratOzdemir-dev thanks for your hint, it helped for me! 🚀

lukasvarkalis avatar Feb 28 '23 22:02 lukasvarkalis