chakra-ui/chakra-ui-vue

v-chakra directive bug : flash of unstyled content when applyed on a external component

JulianCataldo opened this issue · 1 comments

Compare this two :

1 V-chakra directive on a nested component

test.vue

<template>
  <main>
    <c-heading>
      Salut
      <DabadiDabada v-chakra background="red"></DabadiDabada>
    </c-heading>
  </main>
</template>

DabadiDabada.vue

<template>
  <div>
    Lorem ipsum dolor sit amet consectetur adipisicing elit.
  </div>
</template>


2 V-chakra directive on an component living inside the parent

test.vue

<template>
  <main>
    <c-heading>
      Salut
      <div v-chakra background="red">
        Lorem ipsum dolor sit amet consectetur adipisicing elit.
      </div>
    </c-heading>
  </main>
</template>

Results

Screenshot 2021-05-31 at 23 55 14

In both case, it works like above, however you get a flash of styling on case 1.
If you disable javascript (Safari dev menu), styling isn't applied:

Screenshot 2021-05-31 at 23 57 59

With js

Style appended with "className" appendix is added afterward (hence the flash of styling).
Screenshot 2021-05-31 at 23 58 58

No js

No style is appended
Screenshot 2021-05-31 at 23 58 41

Additional note :

If you add some styling on a root chakra component in DabadiDabada.vue, it works along the v-chakra styling on the parent. Still, the styles coming from v-chakra directive suffers from being added afterwards.
Screenshot 2021-06-01 at 0 04 12

Hi @JulianCataldo Are you using this in a nuxt project? I'd like to see a reproduction of this if possible.