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(carousel): removed flickering #2211

Merged
merged 1 commit into from
Jul 29, 2024
Merged

fix(carousel): removed flickering #2211

merged 1 commit into from
Jul 29, 2024

Conversation

agliga
Copy link
Contributor

@agliga agliga commented Jul 9, 2024

Description

  • Before typescript was introduced, the left/right offsets for each items could be initially undefined. This was to verify that the component was being re-rendered. After typescript, the offsets were set to 0. There was a check to verify if the carousel is animating which would specifically check for undefined. Since these were always set, that check would never pass.
  • We need an initial value of null/undefined. The problem with setting 0, is that 0 could be a possible offset and cannot be used to check if there is a re-render.
  • One more issue: there are some comparison checks. If you do any number > or < to undefined, it evaluates as false. This is not the case if its 0. Unfortunately, the code was written expecting those checks to evaluate as false.

Context

  • I added undefined as the default value.
  • I added ! to the undefined values to allow typescript to pass compilation.
  • I also added an example of how to do controlled carousel.

References

#2206

@agliga agliga requested review from ArtBlue and LuLaValva July 9, 2024 16:53
@agliga agliga self-assigned this Jul 9, 2024
Copy link

changeset-bot bot commented Jul 9, 2024

🦋 Changeset detected

Latest commit: 80febe5

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@ebay/ebayui-core Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@agliga agliga changed the title fix(carousel): remvoed flickering fix(carousel): removed flickering Jul 9, 2024
@agliga agliga merged commit 371d277 into 14.1.0 Jul 29, 2024
4 checks passed
@agliga agliga deleted the carousel-next branch July 29, 2024 15:50
This was referenced Jul 16, 2024
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.

2 participants