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

fix(mentions): align type MentionsRef with rc-mentions #38028

Merged
merged 1 commit into from Oct 18, 2022

Conversation

simonwong
Copy link
Contributor

@simonwong simonwong commented Oct 14, 2022

[中文版模板 / Chinese template]

🤔 This is a ...

  • New feature
  • Bug fix
  • Site / documentation update
  • Demo update
  • Component style update
  • TypeScript definition update
  • Bundle size optimization
  • Performance optimization
  • Enhancement feature
  • Internationalization
  • Refactoring
  • Code style optimization
  • Test Case
  • Branch merge
  • Other (about what?)

🔗 Related issue link

💡 Background and solution

Problem

Mentions and rc-mentions export different ref type.
ref type of Mentions is HTMLElement, ref type of rc-mentions is MentionRef.

Solution

Mentions uses a type inherited from MentionRef of rc-mentions.

feature usage sample:

import { Mentions, MentionProps } from 'antd'
import { MentionRef } from 'antd/es/mentions'

const SomeComponent = () => {
  const mentionsRef = React.useRef<MentionsRef>(null)

  const doSomething = () => {
    mentionsRef.current?.focus()
  }

  return (
    <Mentions
      ref={mentionsRef}
    />
  )
}

📝 Changelog

Language Changelog
🇺🇸 English Mentions extra export MentionsRef
🇨🇳 Chinese Mentions 额外导出 MentionsRef

☑️ Self-Check before Merge

⚠️ Please check all items below before requesting a reviewing. ⚠️

  • Doc is updated/provided or not needed
  • Demo is updated/provided or not needed
  • TypeScript definition is updated/provided or not needed
  • Changelog is provided or not needed

@github-actions
Copy link
Contributor

github-actions bot commented Oct 14, 2022

@codecov
Copy link

codecov bot commented Oct 16, 2022

Codecov Report

Base: 100.00% // Head: 100.00% // No change to project coverage 👍

Coverage data is based on head (f641465) compared to base (0992341).
Patch coverage: 100.00% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff            @@
##            master    #38028   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          444       444           
  Lines         8231      8231           
  Branches      2488      2488           
=========================================
  Hits          8231      8231           
Impacted Files Coverage Δ
components/mentions/index.tsx 100.00% <100.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@simonwong
Copy link
Contributor Author

@li-jia-nan 哈喽,可以帮忙看下 imagesnapshot 这个 job 吗,看起来不是代码问题而引起的报错。

Error: Jest: Got error running globalSetup - /app/node_modules/jest-environment-puppeteer/setup.js,
reason: Could not find expected browser (chrome) locally. 
Run `npm install` to download the correct Chromium revision (1045629).

@li-jia-nan
Copy link
Member

修好了,麻烦同步一下master分支~

@afc163 afc163 merged commit 51662df into ant-design:master Oct 18, 2022
@MadCcc MadCcc mentioned this pull request Oct 19, 2022
19 tasks
@simonwong simonwong deleted the mentions-type branch October 20, 2022 01:50
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.

None yet

3 participants