-
-
Notifications
You must be signed in to change notification settings - Fork 35
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: add restartDelay option #68
feat: add restartDelay option #68
Conversation
- Declared as optional, consistent with other types in UpdateOption - Added comments for bettwr clarity
- Applied `??` operator to set default(=300ms) for `undefined` or `null` - Ensures restartDelay applies the user-defined value when provided - Enforces type safety: only `number` values are allowed, preventing invalid types
src/index.tsx
Outdated
@@ -154,7 +154,7 @@ async function downloadBundleUri( | |||
if (option?.restartAfterInstall) { | |||
setTimeout(() => { | |||
resetApp(); | |||
}, 300); | |||
}, option?.restartDelay ?? 300); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it better when use || instead of ??
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I compared the ??
and ||
operators, and it seems that ||
is more appropriate as it covers all falsy
values. I'll apply the change right away! Thanks! 😊
* Delay in milliseconds before restarting the app after installing the update. | ||
* Default: 300ms. | ||
*/ | ||
restartDelay?: number; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It great if you can help me update at readme also
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh! I'll add it right away!
all good, thank for your PR |
Why
The
restartAfterInstall
option in OTA updates had a hardcoded timeout of300ms
before restarting the app.This made it feel like the app restarted too quickly, preventing a smooth transition.
How
To improve flexibility,
restartDelay
is set by the developer.Related Issue
[AS-IS]
[TO-BE]
left - default (300ms) / right - user-defined (3000ms)