refactor(utils): remove isServer (#5173)

This commit is contained in:
btea 2022-01-05 22:00:57 -06:00 committed by GitHub
parent bf1f52b87e
commit 15ffab1255
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 5 deletions

View File

@ -1,5 +1,5 @@
import { computed, inject, unref } from 'vue'
import isServer from '@element-plus/utils/isServer'
import { isClient } from '@vueuse/core'
import { debugWarn } from '@element-plus/utils/error'
import type { InjectionKey, Ref } from 'vue'
@ -21,7 +21,7 @@ export const ID_INJECTION_KEY: InjectionKey<ElIdInjectionContext> =
export const useId = (deterministicId?: MaybeRef<string>): Ref<string> => {
const idInjection = inject(ID_INJECTION_KEY, defaultIdInjection)
if (isServer && idInjection === defaultIdInjection) {
if (!isClient && idInjection === defaultIdInjection) {
debugWarn(
'IdInjection',
`Looks like you are using server rendering, you must provide a id provider to ensure the hydration process to be succeed

View File

@ -1,6 +1,6 @@
import { onBeforeMount } from 'vue'
import { isClient } from '@vueuse/core'
import { generateId } from '@element-plus/utils/util'
import isServer from '@element-plus/utils/isServer'
let cachedContainer: HTMLElement
@ -10,7 +10,7 @@ export const POPPER_CONTAINER_SELECTOR = `#${POPPER_CONTAINER_ID}`
export const usePopperContainer = () => {
onBeforeMount(() => {
if (isServer) return
if (!isClient) return
// This is for bypassing the error that when under testing env, we often encounter
// document.body.innerHTML = '' situation

View File

@ -1 +0,0 @@
export default !(globalThis ? globalThis.document : window)