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

[Sample] Handle crash issue after tapping on the Search Tab. #2339

Merged
merged 1 commit into from
Jul 18, 2023

Conversation

way2jatin
Copy link
Contributor

In order to fix the issue, i needed to tweak with the getRefreshKey method which makes sure it returns a valid Int value. Earlier it was throwing a ClassCastException . But now, the method calculates & returns a refresh key based on the current state of paging data. It uses the anchor position to find the closest page, then checks if there is a previous key available. If there is, it increments it by 1. If the previous key is null, it checks if there is a next key available. If there is, it decrements it by 1. The resulting value represents the refresh key or null if both previous and next keys are null.

Before:
https://github.com/airbnb/lottie-android/assets/8761426/4d24bbcf-44a1-4011-902a-da3b582e437f

After:
https://github.com/airbnb/lottie-android/assets/8761426/b9efebb6-534c-4b89-a354-f857e662b499

@github-actions
Copy link

Snapshot Tests
API 23: Report Diff
API 31: Report Diff

@way2jatin
Copy link
Contributor Author

@gpeal If everything is fine with the PR, then you can go ahead & merge it.

@gpeal gpeal changed the title [FIX] Handle crash issue after tapping on the Search Tab. [Sample] Handle crash issue after tapping on the Search Tab. Jul 18, 2023
@gpeal gpeal merged commit 6c26b9f into airbnb:master Jul 18, 2023
6 checks passed
@way2jatin way2jatin deleted the searchTabCrash branch July 19, 2023 06:59
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

2 participants