Skip to content
This repository was archived by the owner on Apr 6, 2023. It is now read-only.
/frameworkPublic archive
This repository was archived by the owner on Apr 6, 2023. It is now read-only.

Hydration node mismatch when using snipcart <billing> #5215

Description

@baermathias

Environment

  • Operating System: Linux
  • Node Version: v16.15.0
  • Nuxt Version: 3.0.0-rc.3
  • Package Manager: npm@8.5.5
  • Builder: vite
  • User Config: css, build, vue, vite, meta, runtimeConfig
  • Runtime Modules: -
  • Build Modules: -

Reproduction

https://stackblitz.com/edit/github-rytvwm?file=layouts/default.vue

Describe the bug

Using Snipcart with Nuxt works well if you use it just like this

<divhiddenid="snipcart"
data-api-key="my-key-here"
></div>

But if you use an order custom field, which includes native custom elements, you get errors (the below example is from https://docs.snipcart.com/v3/setup/order-custom-fields):

<divhiddenid="snipcart"
data-api-key="my-key-here"
><billingsection="top"><fieldsetclass="snipcart-form__set"><divclass="snipcart-form__field"><snipcart-labelfor="storeToPickUpFrom" class="snipcart__font--tiny">
Store to pick-up from
</snipcart-label><snipcart-selectname="storeToPickUpFrom" class="snipcart-form__select snipcart__font--secondary snipcart__font--bold"><optionvalue="1">One</option><optionvalue="2">Two</option><optionvalue="3"> Three</option><optionvalue="4">Four</option></snipcart-select></div></fieldset></billing></div>

It first tells you to make sure to exclude custom elements from component resolution via compilerOptions.isCustomElement, which is fine and can be handled, but then still the following problem I can't resolve:

[Vue warn]: Hydration node mismatch:
- Client vnode: billing - Server rendered DOM: <!----> at <Default > at <AsyncComponentWrapper > at <BaseTransition mode="out-in" appear=false persisted=false ... > at <Transition name="layout" mode="out-in" > at <Anonymous name="default" > at <App key=1 > at <NuxtRoot>

In the reproduction it can be seen, that it is not displayed correct. Instead of displaying it on the cart in the billing section it is displayed on the page. For the reproduction it is necessary to create a free snipcart account and paste the key into data-api-key. Hope somebody can help me out here.

Additional context

No response

Logs

No response

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions