Skip to content

Commit 7db8c9c

Browse files
authored
chore: use isArray to keep the code consistency
1 parent 870f2a7 commit 7db8c9c

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

packages/server-renderer/src/helpers/ssrRenderSlot.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { ComponentInternalInstance, Slots } from 'vue'
22
import { Props, PushFn, renderVNodeChildren, SSRBufferItem } from '../render'
3+
import { isArray } from '@vue/shared'
34

45
export type SSRSlots = Record<string, SSRSlot>
56
export type SSRSlot = (
@@ -32,7 +33,7 @@ export function ssrRenderSlot(
3233
parentComponent,
3334
slotScopeId ? ' ' + slotScopeId : ''
3435
)
35-
if (Array.isArray(ret)) {
36+
if (isArray(ret)) {
3637
// normal slot
3738
renderVNodeChildren(push, ret, parentComponent, slotScopeId)
3839
} else {

packages/server-renderer/src/helpers/ssrVModelHelpers.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { looseEqual, looseIndexOf } from '@vue/shared'
1+
import { looseEqual, looseIndexOf, isArray } from '@vue/shared'
22
import { ssrRenderAttr } from './ssrRenderAttrs'
33

44
export const ssrLooseEqual = looseEqual as (a: unknown, b: unknown) => boolean
@@ -17,7 +17,7 @@ export function ssrRenderDynamicModel(
1717
case 'radio':
1818
return looseEqual(model, value) ? ' checked' : ''
1919
case 'checkbox':
20-
return (Array.isArray(model)
20+
return (isArray(model)
2121
? ssrLooseContain(model, value)
2222
: model)
2323
? ' checked'
@@ -38,7 +38,7 @@ export function ssrGetDynamicModelProps(
3838
case 'radio':
3939
return looseEqual(model, value) ? { checked: true } : null
4040
case 'checkbox':
41-
return (Array.isArray(model)
41+
return (isArray(model)
4242
? ssrLooseContain(model, value)
4343
: model)
4444
? { checked: true }

0 commit comments

Comments
 (0)