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: handle progress being infinite #740

Merged
merged 1 commit into from
Dec 19, 2024

Conversation

matthieuMay
Copy link
Contributor

@matthieuMay matthieuMay commented Dec 19, 2024

📜 Description

Add a numerical safety test to keyboard animation progress

💡 Motivation and Context

It solves a random crash in production where progress is infinite

Fixes #739 #737 #735

📢 Changelog

Android

  • added isInfinite check along with isNaN;

🤔 How Has This Been Tested?

Releasing it to production via a patch package the error report disappeared

📝 Checklist

  • CI successfully passed
  • I added new mocks and corresponding unit-tests if library API was changed

This was linked to issues Dec 19, 2024
Copy link
Contributor

📊 Package size report

Current size Target Size Difference
164437 bytes 164428 bytes 9 bytes 📈

@kirillzyusko
Copy link
Owner

kirillzyusko commented Dec 19, 2024

A small note from the author of this lib - such check will lead to UI inconsistency (because we are trying to divide non-zero height by 0, so with this fix we'll send something like { height: 40, progress: 0 }). If you depend on height value, you may see a "ghost" keyboard animations (when there is actually no keyboard on a screen, but you see the part of the animation).

I understand, that it may be hard to prepare a reproduction, because it seems like the error is very flaky and it can be present only in heavy prod apps with reach functionality (i. e. it can be a race conditions and it's hard to reproduce it in simple reproduction example).

To deliver a better user experience and don't crash app (in case if value can not be serialized) - you convinced me guys to have that check in the codebase. It's better to show fake/ghost animation rather than crash the app and totally block user interaction with the app.

Still hope that at some point of time someone will prepare a reproduction example and we can figure out what exactly causes this problem. For now - let's have this fix in a codebase to avoid app crashes 🙂

@kirillzyusko
Copy link
Owner

And yes, seems like this problem affects many users, so i'll merge a fix and will publish 1.15.1 version straight away 😊

@kirillzyusko kirillzyusko merged commit fdba1d2 into kirillzyusko:main Dec 19, 2024
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants