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

feat: Do not respond to the Enter event when data is loading #257

Merged
merged 5 commits into from
Jun 6, 2024

Conversation

wanpan11
Copy link
Contributor

@wanpan11 wanpan11 commented Jun 5, 2024

新增 loading 字段
在异步加载数据场景下 当 loading=true 时不响应 Enter 事件

src/Mentions.tsx Outdated Show resolved Hide resolved
// loading skip
if (loading) {
return;
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

需要 stopMeasure 么?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

应该不用吧 这里关掉的话 就需要重新输入才会搜索了(input 里的text就不完整了)

@@ -101,6 +102,7 @@ const InternalMentions = forwardRef<MentionsRef, MentionsProps>(
options,
open,
allowClear,
silent,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

怎么改成 silent 了?不是 loading 么?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

loading 是 antd 中的,rc-mentions 里是没有 loading 态的

@@ -40,6 +40,10 @@ describe('Mentions', () => {
return render(createMentions(props));
}

beforeEach(() => {
jest.useFakeTimers();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

把下面的 beforeEach 和 afterEach 挪上来把,反正也是 fakeTimer

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

把下面的 beforeEach 和 afterEach 挪上来把,反正也是 fakeTimer

done

@zombieJ zombieJ merged commit 39a078d into react-component:master Jun 6, 2024
5 checks passed
@wanpan11 wanpan11 deleted the loading branch June 6, 2024 07:11
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

Successfully merging this pull request may close these issues.

Mentions loading state is not disabling the input
3 participants