fix: Fix types associated with auto lock timer call#25109
Conversation
|
CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes. |
Co-authored-by: Mark Stacey <markjstacey@gmail.com>
| // This is a temporary fix until we add a state migration. | ||
| // Due to a bug in ui/pages/settings/advanced-tab/advanced-tab.component.js, | ||
| // it was possible for timeoutMinutes to be saved as a string, as explained | ||
| // in PR 25109. `alarms.create` will fail in that case. We are | ||
| // converting this to a number here to prevent that failure. Once | ||
| // we add a migration to update the malformed state to the right type, | ||
| // we will remove this conversion. | ||
| const timeoutToSet = Number(timeoutMinutes); |
There was a problem hiding this comment.
Do we have an issue # for the migration task? I want to add a comment to it that this cast should be removed when the migration work is done.
There was a problem hiding this comment.
I do not think we have created one yet
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #25109 +/- ##
========================================
Coverage 65.71% 65.72%
========================================
Files 1360 1360
Lines 54041 54042 +1
Branches 14038 14038
========================================
+ Hits 35513 35515 +2
+ Misses 18528 18527 -1 ☔ View full report in Codecov by Sentry. |
Builds ready [5af6083]
Page Load Metrics (49 ± 4 ms)
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
|
Missing release label release-11.16.8 on PR. Adding release label release-11.16.8 on PR and removing other release labels(release-12.1.0), as PR was cherry-picked in branch 11.16.8. |
Description
We see the following error in sentry

The problem occurs when the user sets this field in advanced settings

If that field is set to empty, then this code in
/ui/pages/settings/advanced-tab/advanced-tab.component.test.jswould result in setting the background state property to the string'0':This
toStringcall was introduced in #19653, but it doesn't seem to be necessary. It also conflicts with the type of the prop that is passed in to initially set this component state property. Also, the_resetTimerfunction in the app-state controller clearly expects this value to be a number.The fix is to not set this component state value as a string. There are a couple of other type related fixes that are not strictly necessary for fixing the bug, but improve the code.
Manual testing steps
Pre-merge author checklist
Pre-merge reviewer checklist