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

v0.4 does not work or SSR #9

Open
frandiox opened this issue Mar 18, 2019 · 9 comments
Open

v0.4 does not work or SSR #9

frandiox opened this issue Mar 18, 2019 · 9 comments
Labels
dependency bug Problem with a dependency

Comments

@frandiox
Copy link

Hi! First of all, thank you for this library. I've been using it for long before 0.4 and was working perfectly. I just updated to 0.4.7 and I'm getting "document is not defined" around this line: https://github.com/Lunrtick/vue-bulma-accordion/blob/master/dist/vue-bulma-accordion.umd.js#L283

I'm using this on Vuepress, which renders everything at build time using Node and obviously document object is not defined. A possible solution is wrapping bulma-accordion in <ClientOnly> so it doesn't render at build time, but then all the text shown in the accordion cannot be indexed by search engines. I guess this is related to Rollup but there should be a way to avoid calling undefined objects in SSR 🤔

Thanks!

@Lunrtick
Copy link
Owner

Hey frandiox, glad to hear that it's been helpful for you!

I have looked into this - it does seem like a problem with Rollup, as you suggested. The pertinent issue is here. There is a possible workaround, as documented here, though that seems pretty irritating to have to deal with.

I will give it some thought, and see if I can figure an alternative out - if you have any suggestions, I'd also love to hear them!

@Lunrtick Lunrtick added the dependency bug Problem with a dependency label Mar 22, 2019
@HugoHeneault
Copy link

I had this issue too with nuxt. Made me downgrade to 0.3.3 which works great too! 🍻

@drbarto
Copy link

drbarto commented Jan 8, 2020

I also downgraded to 0.3.3, luckily we don't need the new features of 0.4.x yet. Any ETA when this issue could be resolved?

@jemjov41
Copy link

jemjov41 commented Jan 20, 2020

i had this issue too, did you using nuxt?,

i resolve this by adding BulmaAccordion and BulmaAccordionItem into plugins,

~plugins/vue-global-components.js file:

import {
    BulmaAccordion,
    BulmaAccordionItem
  } from 'vue-bulma-accordion'

Vue.component('BulmaAccordion', BulmaAccordion);  
Vue.component('BulmaAccordionItem', BulmaAccordionItem);"

and add it in
nuxt.config.js

plugins:[
    {
      src: '~plugins/vue-global-component.js',
      ssr: false
    }]

last dont forget to remove local import at spesific file

@Lunrtick
Copy link
Owner

Lunrtick commented Feb 6, 2020

I've just published 0.5, which changes some implementation details and uses parcel instead of rollup. I don't use SSR much, but from my testing it seems to have fixed the problem (occasionally I saw an HTML mismatch during testing, couldn't figure out why).

I would love to get a hand from someone who uses SSR!

@HugoHeneault
Copy link

Hey there! So I'm using SSR and with 0.5.2 it's working fine. Awesome! 👏

With nuxt when you first load a page containing the accordion and initial-open-items it's opening on page ready (I think).

But when you navigate to the page with nuxt/vue rendering client side the items don't open.

Is it SSR related or shall I open another issue?

@HugoHeneault
Copy link

HugoHeneault commented Feb 7, 2020

I also have the error:

The client-side rendered virtual DOM tree is not matching server-rendered content. 

What coud I do to help you?

@Lunrtick
Copy link
Owner

Lunrtick commented Feb 8, 2020

With nuxt when you first load a page containing the accordion and initial-open-items it's opening on page ready (I think).

But when you navigate to the page with nuxt/vue rendering client side the items don't open.

Is it SSR related or shall I open another issue?

It seems to be SSR related, so let's keep it here (:

@Lunrtick
Copy link
Owner

Lunrtick commented Feb 8, 2020

I also have the error:

The client-side rendered virtual DOM tree is not matching server-rendered content. 

What coud I do to help you?

When I got that error, I compared the client rendered html character by character with the SSR'd html - they seem to be identical. My intuition says I'm doing something that SSR doesn't like (maybe the inline styles or something), but I don't have any experience with it, so I don't know.

This Stackeroverflow answer may help with debugging the issue - I will look into it locally as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependency bug Problem with a dependency
Projects
None yet
Development

No branches or pull requests

5 participants