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

Compatibility with asynchronous loading? #56

Open
Nincha opened this issue Jul 25, 2023 · 2 comments
Open

Compatibility with asynchronous loading? #56

Nincha opened this issue Jul 25, 2023 · 2 comments

Comments

@Nincha
Copy link

Nincha commented Jul 25, 2023

Hello there :)

As I'm working on a Quasar project I've been facing an issue while trying to use the library.

Quasar's particularity is to offer some SSR render, so I had to make a small tweak to load the component with defineAsyncComponent (as a basic import would break the server side).

Here's the simple component I've made up for basic testing:

<template>

  <q-no-ssr>

    <EmojiPicker :native="true" @select="onSelectedEmoji" />

    <template v-slot:placeholder>
      <q-skeleton height="48px" style="margin-top: 1rem; border-radius: 0.75rem;"/>
    </template>
  </q-no-ssr>

</template>

<script>
import {ref, defineComponent, defineAsyncComponent} from 'vue'

export default defineComponent({
  name: 'ChatInput',
  components: {
    EmojiPicker: defineAsyncComponent(() => import('vue3-emoji-picker'))
  },
  setup () {

    const onSelectedEmoji = (emoji) => {
      console.log(emoji)
    }
    return {
      onSelectedEmoji,
    }
  },
})
</script>
<style lang="scss">
// $
@import 'node_modules/vue3-emoji-picker/dist/style';
</style>

This is resulting in the component being "semi-rendered" as I see in HTML <picker-root type="" text=""></picker-root>, and I also have those two warnings in console :

[Vue warn]: provide() can only be used inside setup().
[Vue warn]: resolveComponent can only be used in render() or setup().


Would you have any idea about why it occurs, or how to load the component asynchronously?

I've also tried to setup a server-only boot file for Quasar like the following (but it didn't help either, giving the same result/warning):

import { boot } from 'quasar/wrappers'

export default boot(async ({ app }) => {
  const EmojiPicker = require('vue3-emoji-picker').default
  app.component('EmojiPicker', EmojiPicker)
})

Thanks in advance for any piece of help and have a great day!

@deadAdrian
Copy link

deadAdrian commented May 20, 2024

@Nincha did you solve your problem? i am current having a problem in nuxt, where the whole app breaks in production with this lib. I have tried using <ClientOnly>, kind of your <q-no-ssr>, but no success

@arbisyarifudin
Copy link

Same here

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

3 participants