mirror of
https://github.com/tusen-ai/naive-ui.git
synced 2024-12-15 04:42:23 +08:00
fix: components with rtl support throws error in SSR
This commit is contained in:
parent
0e6926cef4
commit
698e557797
@ -11,6 +11,7 @@
|
||||
- Fix `n-global-style` applies style transition on first mount.
|
||||
- Fix `n-drawer` border transition, closes[#1211].
|
||||
- Fix `n-input-number`'s `value` prop can't be `null` type.
|
||||
- Fix components with rtl support throws error in SSR.
|
||||
|
||||
### Feats
|
||||
|
||||
|
@ -11,6 +11,7 @@
|
||||
- 修复 `n-global-style` 在首次挂载时应用样式过渡
|
||||
- 修复 `n-drawer` 边界缺少 transition,关闭 [#1211]
|
||||
- 修复 `n-input-number` 的 `value` 属性不能为 null 类型
|
||||
- 修复支持 rtl 的组件 SSR 报错
|
||||
|
||||
### Feats
|
||||
|
||||
|
@ -80,7 +80,7 @@
|
||||
"@vue/compiler-sfc": "^3.0.10",
|
||||
"@vue/eslint-config-standard": "^6.0.0",
|
||||
"@vue/eslint-config-typescript": "^7.0.0",
|
||||
"@vue/server-renderer": "^3.2.12",
|
||||
"@vue/server-renderer": "^3.2.18",
|
||||
"@vue/test-utils": "^2.0.0-rc.9",
|
||||
"autoprefixer": "^10.2.6",
|
||||
"babel-eslint": "^10.1.0",
|
||||
|
@ -31,7 +31,7 @@ export default function useRtl (
|
||||
// if it already exists, we only need to watch clsPrefix, although in most
|
||||
// of time it's unnecessary... However we can at least listen less
|
||||
// handlers, which is great.
|
||||
if (exists(id)) return
|
||||
if (exists(id, ssrAdapter)) return
|
||||
const { value: componentRtlState } = componentRtlStateRef
|
||||
if (!componentRtlState) return
|
||||
componentRtlState.style.mount({
|
||||
|
25
src/config-provider/tests/server.spec.tsx
Normal file
25
src/config-provider/tests/server.spec.tsx
Normal file
@ -0,0 +1,25 @@
|
||||
/**
|
||||
* @jest-environment node
|
||||
*/
|
||||
import { h, createSSRApp } from 'vue'
|
||||
import { renderToString } from '@vue/server-renderer'
|
||||
import { setup } from '@css-render/vue3-ssr'
|
||||
import { NConfigProvider, NButton } from '../..'
|
||||
|
||||
describe('SSR', () => {
|
||||
it('works', async () => {
|
||||
const app = createSSRApp(() => (
|
||||
<NConfigProvider>
|
||||
{{
|
||||
default: () => <NButton />
|
||||
}}
|
||||
</NConfigProvider>
|
||||
))
|
||||
setup(app)
|
||||
try {
|
||||
await renderToString(app)
|
||||
} catch (e) {
|
||||
expect(e).not.toBeTruthy()
|
||||
}
|
||||
})
|
||||
})
|
@ -1,2 +1,4 @@
|
||||
// https://github.com/jsdom/jsdom/issues/1422
|
||||
HTMLDivElement.prototype.scrollTo = () => {}
|
||||
if (typeof window !== 'undefined') {
|
||||
HTMLDivElement.prototype.scrollTo = () => {}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user