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

Invoking a dialog reloads other components #42

Closed
ChibiChanNya opened this issue Jul 1, 2019 · 10 comments
Closed

Invoking a dialog reloads other components #42

ChibiChanNya opened this issue Jul 1, 2019 · 10 comments

Comments

@ChibiChanNya
Copy link

ChibiChanNya commented Jul 1, 2019

Lately I came across a very weird issue when using your dialogs in my Nuxt project. Whenever I invoke a dialog to show up, the page attempts to reload other components, such as vuetify-icons, and it often fails. I'm not sure why this is happening since components are not re-mounted, but it looks like this:
BEFORE:
image
AFTER:
image

I had originally figured it would be some artifact from developer environment, but it happens in production as well. I have re-installed vuetify-dialog with latest version and using default settings and this continues to happen on any instance of invoking something to show up, for example:

 showDialog(){
        this.$dialog.notify.success('TEST!',
          {
            position: 'top-middle',
            timeout: 5000
          })

Occasionally the icons return after a moment or two, but sometimes it just stays screwed up like that.
It doesn't affect just icons, as it attempts to reload header scripts like google tag manager, facebook pixel, etc.

@yariksav
Copy link
Owner

yariksav commented Jul 1, 2019

Hi! It's srtange. Something happens with icon fonts in vuetify. What kind of vuetify icons do you use? For me is to complicated to understand reason without sufficient information or maybe reproducing example in codesandbox

@ChibiChanNya
Copy link
Author

Are normal material design icons from Vuetify. For example:
<v-icon class="blue--text text--lighten-2">phone</v-icon>
I may have a few fontAwesome ones here and there as well.

I need to make more experiments to be sure what the problem is, it's a kinda big nuxt project so would be hard to replicate on a sandbox but I will see what I can do.

@yariksav
Copy link
Owner

yariksav commented Jul 1, 2019

This would be good! You don't need to replicate all project. Just make an little instance in codesandbox. In my projects i haven’t seen this behaivour. But i use just material icons font

@yariksav
Copy link
Owner

yariksav commented Jul 1, 2019

And you wrote that showing dialog starts rerendering all page. But it doesn’t have to touch for updating not related components

@ChibiChanNya
Copy link
Author

ChibiChanNya commented Jul 1, 2019

Lifecycle hooks don't run again. I tried putting some code on "Mounted" and it doesn't run when this happens. However, the loading bar in Nuxt (default on top of the app) does show for a brief moment even if i'm not navigating anywhere and Facebook pixel tells me I'm attemping to register a duplicate ID every time this happens.

EDIT: I'm not positive on the loading bar thing. It happens when I use Axios, but might be a different side-effect.

@ChibiChanNya
Copy link
Author

I've come to the conclusion that the problem module in this case is "nuxt-i18n" for internationalization. Using your lib is causing it to try to re-render the page. I wonder if I can configure it to avoid this.

@ChibiChanNya
Copy link
Author

ChibiChanNya commented Jul 1, 2019

I managed to replicate problem with the minimum of files.
Nuxt-i18n is the culprit, but I don't know how to fix. It's included in the project but it's not actually using any translation, that's enough to cause this issue.
Here is a codesandbox link to try it: https://codesandbox.io/s/github/ChibiChanNya/vuetify-dialog-test/tree/master/?fontsize=14

@yariksav
Copy link
Owner

yariksav commented Jul 2, 2019

Thank you, @ChibiChanNya for your work for replication. I've investigated this problem and:

  1. After dialog shows - loose all nuxt.head properties in tag
    Before
    image
    and after
    image
    This impacted by nuxt-i18n SEO
    To temporary solve this problem you have to add param seo: false to nuxtI18n option
    see https://codesandbox.io/s/vuetify-dialog-test-53ovx
    I guess the problem not in vuetify-dialog, because module doesn't inmpact any heads, i18n's and etc

Later I will study code of nuxt-i18n.seo

@yariksav
Copy link
Owner

yariksav commented Jul 2, 2019

Please read https://nuxt-community.github.io/nuxt-i18n/seo.html#improving-performance , it's better for perfomance set seo=false and then in each layout put code

// layouts/default.vue

export default {
  head () {
    return this.$nuxtI18nSeo()
  }
}

because this code
https://github.com/nuxt-community/nuxt-i18n/blob/master/src/templates/seo-head.js
works for EVERY vue component, and dialogs also. And doesn't work correctly in occasions

Look into lauouts/default.vue at https://codesandbox.io/s/vuetify-dialog-test-53ovx

@yariksav yariksav closed this as completed Jul 2, 2019
@ChibiChanNya
Copy link
Author

Thanks as always @yariksav , second time you save me. I really like this lib. Confirmed all good!

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

No branches or pull requests

2 participants