Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: add support for SSR in DeviceHelperPlugin #249

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

bojanrajh
Copy link
Contributor

@bojanrajh bojanrajh commented Jul 30, 2024

What?

This PR updates nuxt-app example with MtTabs component which is using DeviceHelper plugin + it activates SSR.

Why?

To allow server-side rendering when DeviceHelper is used.

How?

By checking for the window variable.

Testing?

Locally, with provided nuxt-app example.

Screenshots (optional)

Anything Else?

Copy link

vercel bot commented Jul 30, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
meteor-component-library ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 21, 2024 3:07pm
1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
meteor-admin-sdk-docs ⬜️ Ignored (Inspect) Visit Preview Aug 21, 2024 3:07pm

Copy link
Contributor

@Haberkamp Haberkamp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a changelog

@@ -20,6 +20,8 @@
</p>

<SwTextField label="A text field" v-model="text" />

<MtTabs :items="[{ label: 'Foo' }, { label: 'Bar' }]" />
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Though this is enough to test that the DeviceHelper is SSR compatible, I suggest to make this component do something like switching between content. This way we can be sure that switching views also works when using SSR. Additionally it creates a nicer demo page.

Copy link
Contributor Author

@bojanrajh bojanrajh Aug 20, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ideally, a full integration test would be needed here. But. We did end up with a few composables which I would like to introduce in separate PRs, maybe even a separate package (@shopware-ag/meteor-nuxt):

  • useMeteorTabs - framework-agnostic, might as well end up in @shopware-ag/meteor-component-library
  • useMeteorToast, useMeteorModal (depends on Nuxt's useState)
  • useMeteorForm - provides a layer between joi (and compatible) and shopware/meteor validation format, along with a few nuxt-based form components based on meteor components
  • useColorMode - composable for managing system/light/dark modes based on meteor dark theme implementation (html attr).

Therefore, I would like to keep those PRs small and update the implementation (for example in the mt-toast.stories.ts and nuxt-app demo) along the way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
package: components @meteor/components
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants