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: render state value in children render always get init one #2634

Merged
merged 1 commit into from
Dec 16, 2024

Conversation

YannLynn
Copy link
Collaborator

@YannLynn YannLynn commented Dec 16, 2024

中文模板 / Chinese Template

What kind of change does this PR introduce? (check at least one)

  • Bugfix
  • Feature
  • Code style update
  • Refactor
  • Test Case
  • TypeScript definition update
  • Document improve
  • CI/CD improve
  • Branch sync
  • Other, please describe:

PR description

Fixes #2633
之前的写法将 children 放在 state 中维护,仅在 key 值改变的时候更新 children,导致在 children 渲染 state (如 currentIndex 值)仅能得到一开始的初始值。
修复后 children 根据当前 props 生成,在 children 渲染 state 值能够正确更新。

Changelog

🇨🇳 Chinese

  • Fix: 修复 Carousel 在 children 中渲染 state 的值不更新问题

🇺🇸 English

  • Fix: fix render state value in Carousel children always get the init one

Checklist

  • Test or no need
  • Document or no need
  • Changelog or no need

Other

  • Skip Changelog

Additional information

@YannLynn YannLynn requested a review from pointhalo December 16, 2024 08:21
Copy link

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit 38e9448:

Sandbox Source
pr-story Configuration

@YannLynn YannLynn requested review from YyumeiZhang and removed request for pointhalo December 16, 2024 08:25
Copy link

cypress bot commented Dec 16, 2024

semi-design    Run #3022

Run Properties:  status check passed Passed #3022  •  git commit 4af2aa9612 ℹ️: Merge 38e9448a0d027a190ecf52f63f03bad7d0ccc7d7 into e65e2dcb2c75c77a7c41234b1e7b...
Project semi-design
Branch Review fix-2633
Run status status check passed Passed #3022
Run duration 07m 48s
Commit git commit 4af2aa9612 ℹ️: Merge 38e9448a0d027a190ecf52f63f03bad7d0ccc7d7 into e65e2dcb2c75c77a7c41234b1e7b...
Committer YannLynn
View all properties for this run ↗︎

Test results
Tests that failed  Failures 0
Tests that were flaky  Flaky 0
Tests that did not run due to a developer annotating a test with .skip  Pending 11
Tests that did not run due to a failure in a mocha hook  Skipped 0
Tests that passed  Passing 277
⚠️ You've recorded test results over your free plan limit.
Upgrade your plan to view test results.
View all changes introduced in this branch ↗︎

@YyumeiZhang YyumeiZhang merged commit 2c43674 into main Dec 16, 2024
10 checks passed
@YyumeiZhang YyumeiZhang deleted the fix-2633 branch December 16, 2024 08:43
Copy link

cypress bot commented Dec 16, 2024

semi-design    Run #3023

Run Properties:  status check passed Passed #3023  •  git commit 2c43674a31: fix: render state value in children render always get init one (#2634)
Project semi-design
Branch Review main
Run status status check passed Passed #3023
Run duration 07m 51s
Commit git commit 2c43674a31: fix: render state value in children render always get init one (#2634)
Committer YannLynn
View all properties for this run ↗︎

Test results
Tests that failed  Failures 0
Tests that were flaky  Flaky 0
Tests that did not run due to a developer annotating a test with .skip  Pending 11
Tests that did not run due to a failure in a mocha hook  Skipped 0
Tests that passed  Passing 277
⚠️ You've recorded test results over your free plan limit.
Upgrade your plan to view test results.
View all changes introduced in this branch ↗︎

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.

[Carousel] render state value in children always get the init one
2 participants