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

ant-design-vue some components cannot render twice under vitepress build. #3718

Closed
4 tasks done
qianyuhouse opened this issue Mar 29, 2024 · 4 comments
Closed
4 tasks done
Labels
bug: pending triage Maybe a bug, waiting for confirmation

Comments

@qianyuhouse
Copy link

Describe the bug

dependencies used

  • "ant-design-vue": "3.2.20".
  • "vitepress": "^1.0.1".
  • "vue": "^3.2.38".
  • "@vitejs/plugin-vue": "^5.0.4"
  • "vite": "^5.2.0"

A custom layout in .vitepress/theme like below.

<template>
  <div>
    <Button @click="handleClick">切换 显示和隐藏</Button>
    <Empty v-if="visible" />
    <Empty />
  </div>
</template>
<script lang="ts" setup>
import { Empty } from 'ant-design-vue';
import { ref } from "vue"
const visible = ref(true)

const handleClick = () => {
  visible.value = !visible.value

}
</script>

Reproduction

Steps

  1. build.
    vitepress build docs.
  2. serve.
    vitepress serve docs.
  3. Click Button in the page.

Problem I face

Everything is normal at the first.But when I click the button to change the element in the page, 'Empty' component cannot be rendered.
image

Expected behavior

Expected.

No matter re-render times, I hope it can be rendered normal.

image

System Info

There's no any extra info.

Additional context

No response

Validations

@qianyuhouse qianyuhouse added the bug: pending triage Maybe a bug, waiting for confirmation label Mar 29, 2024
@brc-dd
Copy link
Member

brc-dd commented Mar 29, 2024

That component is broken in SSR. Please create an issue at their repo instead (most likely its same as vueComponent/ant-design-vue#6939). The issue is reproducible with Nuxt too.

@brc-dd brc-dd closed this as not planned Won't fix, can't repro, duplicate, stale Mar 29, 2024
@qianyuhouse
Copy link
Author

That component is broken in SSR. Please create an issue at their repo instead (most likely its same as vueComponent/ant-design-vue#6939). The issue is reproducible with Nuxt too.

thanks

@brc-dd
Copy link
Member

brc-dd commented Mar 29, 2024

Wrapping it with <ClientOnly> doesn't work either. My guess is their SSR style rendering thing they added in v4 has bugs. You probably can use older versions I guess or switch to client-side vite app or a different component library.

@qianyuhouse
Copy link
Author

Wrapping it with <ClientOnly> doesn't work either. My guess is their SSR style rendering thing they added in v4 has bugs. You probably can use older versions I guess or switch to client-side vite app or a different component library.

I have tried using antd@v3 wrapped with <ClientOnly>, but it doesn't work either. I have looked at their source code, that image Vnode is declared at the global environment and it's a constant. And Vue3 docs notes that Vnode Must Be Unique.I don't know whether it's the cause or not.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 28, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug: pending triage Maybe a bug, waiting for confirmation
Projects
None yet
Development

No branches or pull requests

2 participants