plasmicapp / plasmic

Visual builder for React. Build apps, websites, and content. Integrate with your codebase.
https://www.plasmic.app
MIT License
4.72k stars 382 forks source link

[Next.js] PlasmicRootProvider globalVariants Typing Issue #43

Closed buraksakalli closed 6 months ago

buraksakalli commented 2 years ago

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[].'
ryscheng commented 2 years ago

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 commented 2 years ago

Please let me know if this solves it for you?

buraksakalli commented 2 years ago

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 }]}
ryscheng commented 2 years ago

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!

code0wl commented 1 year ago

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?

yang commented 1 year ago

@code0wl Followed up with you on Slack!

MuratOzdemir-dev commented 1 year ago

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

lukasvarkalis commented 1 year ago

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