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

fix(comp:empty): the ids in svg should be only #1539

Merged
merged 2 commits into from
Apr 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
18 changes: 4 additions & 14 deletions packages/cdk/portal/src/Portal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* found in the LICENSE file at https://github.com/IDuxFE/idux/blob/main/LICENSE
*/

import { Teleport, computed, defineComponent, ref, watch } from 'vue'
import { Teleport, computed, defineComponent } from 'vue'

import { isFunction, isString } from 'lodash-es'

Expand All @@ -17,23 +17,13 @@ export default defineComponent({
name: 'CdkPortal',
props: portalProps,
setup(props, { slots }) {
const loaded = ref(props.load)
watch(
() => props.load,
load => {
if (!loaded.value) {
loaded.value = load
}
},
)

const elementRef = computed(() => convertTargetElement(props.target))

let rendered = false
return () => {
if (!loaded.value) {
if (!rendered && !props.load) {
return null
}

rendered = true
return (
<Teleport to={elementRef.value} disabled={props.disabled}>
{slots.default && slots.default()}
Expand Down
11 changes: 7 additions & 4 deletions packages/cdk/utils/src/tryOnScopeDispose.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,12 @@ import { getCurrentScope, onScopeDispose } from 'vue'
* @param fn
*/
export function tryOnScopeDispose(fn: () => void): boolean {
if (getCurrentScope()) {
onScopeDispose(fn)
return true
// https://github.com/vuejs/core/issues/6538
// 导致跑 TEST 的时候,内存爆了,先关掉
if (__TEST__ || !getCurrentScope()) {
return false
}
return false

onScopeDispose(fn)
return true
}

Large diffs are not rendered by default.

Large diffs are not rendered by default.

412 changes: 210 additions & 202 deletions packages/components/empty/src/Images.tsx

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions packages/site/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ export default defineConfig(({ command, mode }) => {
},
define: {
__DEV__: !isBuild,
__TEST__: false,
__VERSION_CDK__: `'${cdkPackage.version}'`,
__VERSION_COMPONENTS__: `'${componentsPackage.version}'`,
__VERSION_PRO__: `'${proPackage.version}'`,
Expand Down
3 changes: 2 additions & 1 deletion scripts/gulp/build/rollup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ import { upperFirst } from 'lodash'
import { Plugin, RollupOptions } from 'rollup'
import typescript from 'rollup-plugin-typescript2'

import { esbuildPlugin } from './esbuild'
import cdkPackage from '../../../packages/cdk/package.json'
import componentsPackage from '../../../packages/components/package.json'
import proPackage from '../../../packages/pro/package.json'
import { esbuildPlugin } from './esbuild'

interface Options {
targetDirname: string
Expand All @@ -28,6 +28,7 @@ interface Options {
const externalDeps = ['vue', '@vue', '@idux', '@floating-ui/dom', 'date-fns', 'lodash-es', 'ajv']
const replaceOptions = {
__DEV__: "process.env.NODE_ENV !== 'production'",
__TEST__: false,
__VERSION_CDK__: `'${cdkPackage.version}'`,
__VERSION_COMPONENTS__: `'${componentsPackage.version}'`,
__VERSION_PRO__: `'${proPackage.version}'`,
Expand Down
1 change: 1 addition & 0 deletions typings/global.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ export {}

declare global {
const __DEV__: boolean
const __TEST__: boolean
const __VERSION_CDK__: string
const __VERSION_COMPONENTS__: string
const __VERSION_PRO__: string
Expand Down
1 change: 1 addition & 0 deletions vitest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,5 +43,6 @@ export default defineConfig({

define: {
__DEV__: true,
__TEST__: true,
},
})