-
Notifications
You must be signed in to change notification settings - Fork 975
Set transition back to false when not needed to avoid being stuck in limbo #11763
Conversation
const checkBtcBatMigrated = (state, status) => { | ||
if (!status) { | ||
const checkBtcBatMigrated = (state, paymentsEnabled) => { | ||
if (!paymentsEnabled) { |
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.
renamed the variable to be more meaningful (and also match other places in the file)
@@ -2373,6 +2373,8 @@ const checkBtcBatMigrated = (state, status) => { | |||
if (!isNewInstall && !hasUpgradedWallet) { | |||
state = migrationState.setTransitionStatus(state, true) | |||
module.exports.transitionWalletToBat() | |||
} else { | |||
state = migrationState.setTransitionStatus(state, false) |
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.
This is the big bug fix- if it's an existing install and hasn't upgraded yet, it needs to start (or in the case where you quit, restart) the transition process. Otherwise, it should hide the transition because that is no longer valid
@@ -170,7 +171,7 @@ class EnabledContent extends ImmutableComponent { | |||
render () { | |||
const ledgerData = this.props.ledgerData | |||
const walletStatusText = walletStatus(ledgerData) | |||
const inTransition = ledgerData.getIn(['migration', 'btc2BatTransitionPending']) === true | |||
const inTransition = migrationState.inTransition(ledgerData) |
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.
simple cleanup to put in helper method
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.
HOWEVER... notice that it says migration
instead of migrations
. This was a bug I caught with the unit tests. I'm not sure how this ever returned true?
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.
This is failing for me and only see disabled screen on payments when upgrading from 0.18.x. This is the error:
(BLESSED_EXTENSION context for mnojpmjdmbbfmejpflffifhffcmidifd) http://localhost:8080/gen/aboutPages.entry.js:17915: Uncaught AssertionError: state must contain an Immutable.Map of migrations{AssertionError: state must contain an Immutable.Map of migrations
at validateState (http://localhost:8080/gen/aboutPages.entry.js:173611:10)
at Object.inTransition (http://localhost:8080/gen/aboutPages.entry.js:173626:13)
at EnabledContent.render (http://localhost:8080/gen/aboutPages.entry.js:102839:41)
at http://localhost:8080/gen/aboutPages.entry.js:78075:21
at measureLifeCyclePerf (http://localhost:8080/gen/aboutPages.entry.js:77355:12)
at ReactCompositeComponentWrapper._renderValidatedComponentWithoutOwnerOrContext (http://localhost:8080/gen/aboutPages.entry.js:78074:25)
at ReactCompositeComponentWrapper._renderValidatedComponent (http://localhost:8080/gen/aboutPages.entry.js:78101:32)
at ReactCompositeComponentWrapper.performInitialMount (http://localhost:8080/gen/aboutPages.entry.js:77641:30)
at ReactCompositeComponentWrapper.mountComponent (http://localhost:8080/gen/aboutPages.entry.js:77537:21)
at Object.mountComponent (http://localhost:8080/gen/aboutPages.entry.js:25250:35)}
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.
This is working because this is not state
but ledgerData
which is generated here
browser-laptop/app/browser/tabs.js
Line 243 in f52a109
.set('migration', migration) |
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.
OK I can fix this- we are OK to use the state helper because the path is identical, but it might be sloppy to do so (in case things change). The problem in our case is the validation that is done, which throws the error.
I'll change it back to the hardcoded path since the state helper shouldn't be used to evaluate ledgerData (even if the path matches)
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.
wait- nevermind, I see the problem... fixing
}, | ||
Synopsis: batPublisher.Synopsis | ||
} | ||
mockery.registerMock('bat-publisher', lp) |
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.
This is basically what fixes the tests. Without bat-publisher
being mocked, I was getting the leak error on my machine
Marking as work-in-progress... the tests are having another issue now |
removing WIP label- I confirmed this does fix the unit tests 😄 👍 Ready for review! 😄 |
Codecov Report
@@ Coverage Diff @@
## master #11763 +/- ##
==========================================
- Coverage 52.76% 52.61% -0.15%
==========================================
Files 271 271
Lines 25713 25715 +2
Branches 4104 4104
==========================================
- Hits 13567 13530 -37
- Misses 12146 12185 +39
|
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.
Just tested out PR and transition overlay is not triggered for me when I upgrade from 0.18 wallet. Probably because of that state error
@NejcZdovc fixed, ready for re-review |
…limbo This commit also fixes a leak that the tests had (which was due to tests running and including bat-publisher). Fixes #11566 Fixes #11757 Auditors: @NejcZdovc, @bbondy
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.
++
Set transition back to false when not needed to avoid being stuck in limbo
Set transition back to false when not needed to avoid being stuck in limbo
Set transition back to false when not needed to avoid being stuck in limbo
This commit also fixes a leak that the tests had (which was due to tests running and including bat-publisher).
Fixes #11566
Fixes #11757
Auditors: @NejcZdovc, @bbondy
Submitter Checklist:
git rebase -i
to squash commits (if needed).Test Plan:
Reviewer Checklist:
Tests