Repository: element-plus/element-plus
File: packages/components/select/src/select.vue (Vue)

Code before:
          // @ts-expect-error
          const _name = item.type.name
          if (_name === 'ElTree') {
            // tree-select component is a special case.
            // So we need to handle it separately.
            const treeData = item.props?.data || []
            const flatData = flatTreeSelectData(treeData)
            flatData.forEach((treeItem: any) => {
              treeItem.currentLabel =
                treeItem.label ||
                (isObject(treeItem.value) ? '' : treeItem.value)
              API.onOptionCreate(treeItem)
            })
          } else if (_name === 'ElOption') {
            const obj = { ...item.props } as any
            obj.currentLabel =
              obj.label || (isObject(obj.value) ? '' : obj.value)
            API.onOptionCreate(obj)
          }
        }
      })
    }
    watch(
      () => [slots.default?.(), modelValue.value],
      () => {
        if (props.persistent || API.states.options.size) {
          // If persistent is true, we don't need to manually render slots.
          return
        }
        manuallyRenderSlots(slots.default?.())
      },
      {
        immediate: true,
      }
    )

    provide(
      selectKey,
      reactive({
        props: _props,
        states: API.states,
        selectRef: API.selectRef,
        optionsArray: API.optionsArray,
        setSelected: API.setSelected,
        handleOptionSelect: API.handleOptionSelect,
        onOptionCreate: API.onOptionCreate,
        onOptionDestroy: API.onOptionDestroy,
      }) satisfies SelectContext
    )

    const selectedLabel = computed(() => {

Review comment (suggestion):
```suggestion
        if (props.persistent || API.states.options.size > 0) {
```
Explicitly returning a boolean looks cleaner.

Code after:
          // @ts-expect-error
          const _name = item.type.name
          if (_name === 'ElTree') {
            // tree-select component is a special case.
            // So we need to handle it separately.
            const treeData = item.props?.data || []
            const flatData = flatTreeSelectData(treeData)
            flatData.forEach((treeItem: any) => {
              treeItem.currentLabel =
                treeItem.label ||
                (isObject(treeItem.value) ? '' : treeItem.value)
              API.onOptionCreate(treeItem)
            })
          } else if (_name === 'ElOption') {
            const obj = { ...item.props } as any
            obj.currentLabel =
              obj.label || (isObject(obj.value) ? '' : obj.value)
            API.onOptionCreate(obj)
          }
        }
      })
    }
    watch(
      () => [slots.default?.(), modelValue.value],
      () => {
        if (props.persistent || API.states.options.size > 0) {
          // If persistent is true, we don't need to manually render slots.
          return
        }
        manuallyRenderSlots(slots.default?.())
      },
      {
        immediate: true,
      }
    )

    provide(
      selectKey,
      reactive({
        props: _props,
        states: API.states,
        selectRef: API.selectRef,
        optionsArray: API.optionsArray,
        setSelected: API.setSelected,
        handleOptionSelect: API.handleOptionSelect,
        onOptionCreate: API.onOptionCreate,
        onOptionDestroy: API.onOptionDestroy,
      }) satisfies SelectContext
    )

    const selectedLabel = computed(() => {