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(useHistoryTravel): add limit history length parameter #1921

Merged
merged 1 commit into from Oct 18, 2022

Conversation

Alt-er
Copy link
Contributor

@Alt-er Alt-er commented Oct 17, 2022

[中文版模板 / Chinese template]

🤔 This is a ...

  • New feature
  • Bug fix
  • Site / documentation update
  • Demo 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

issue

💡 Background and solution

Limit the maximum number of history records to avoid excessive memory consumption.

//  limit 100
const { value, setValue, backLength, forwardLength, back, forward } = useHistoryTravel<string>(
  'initial value',
  100
);

📝 Changelog

Language Changelog
🇺🇸 English feat(useHistoryTravel): add limit history size parameter
🇨🇳 Chinese feat(useHistoryTravel): 添加限制历史记录大小参数

☑️ Self Check before Merge

⚠️ Please check all items below before review. ⚠️

  • 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

@CLAassistant
Copy link

CLAassistant commented Oct 17, 2022

CLA assistant check
All committers have signed the CLA.

@Alt-er Alt-er changed the title feat(useHistoryTravel): add limit history size parameter feat(useHistoryTravel): add limit history length parameter Oct 18, 2022
@Alt-er Alt-er force-pushed the master branch 3 times, most recently from 61958d8 to 4d8100a Compare October 18, 2022 08:33
| 参数 | 说明 | 类型 | 默认值 |
| ------------ | -------------------------- | -------- | -------- |
| initialValue | 可选,初始值 | `any` | - |
| maxLength | 可选,限制历史记录最大长度 | `number` | 0 不限制 |
Copy link
Collaborator

Choose a reason for hiding this comment

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

这里的说明加一下如果超出最大长度之后,是怎么处理的吧。不然我觉得可以会迷惑,超出了之后是加不进去,还是删除前面的呢。

Copy link
Contributor Author

Choose a reason for hiding this comment

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

好的 , 已添加说明, 请查看

@crazylxr
Copy link
Collaborator

LGTM

@crazylxr crazylxr merged commit ae9cc20 into alibaba:master Oct 18, 2022
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