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

[BUG] When the list component data is empty, the loading state exceeds the list div. #2683

Open
1 task done
LonelySnowman opened this issue Jan 22, 2025 · 1 comment
Open
1 task done

Comments

@LonelySnowman
Copy link
Contributor

LonelySnowman commented Jan 22, 2025

Is there an existing issue for this?

  • I have searched the existing issues

Which Component

List

Semi Version

2.74.0-beta.0

Current Behavior

List 组件 dataSource 为空数组并且,loading 为 true 时。List 组件高度为 0,如果 List 上方或下方有元素,会被 Spin 遮挡。

Expected Behavior

dataSource 为空数组时保留 Empty 状态并展示 Spin Loading。

Steps To Reproduce

官网预览下面的代码可复现。

import React from 'react';
import { List } from '@douyinfe/semi-ui';

() => {
    const data = [];
    return (
        <div style={{ marginRight: 16, width: 280, display: 'flex', flexDirection: 'column' }}>
            <div style={{ height: 20, width: '100%', backgroundColor: 'green' }}></div>
            <List
                dataSource={data}
                split={false}
                loading={true}
                size='small'
                renderItem={(item) =>
                    <List.Item>{item}</List.Item>
                }
            />
        </div>
    );
};

Anything else?

如果这个不符合预期的话,我可以提交一个 PR 解决这个问题 😊

@DaiQiangReal
Copy link
Collaborator

辛苦了 PR welcome

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants