-
Notifications
You must be signed in to change notification settings - Fork 82
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
frontend: transform aopp.tsx to funcitonal component #2761
base: master
Are you sure you want to change the base?
Conversation
855fcd3
to
a0bbec8
Compare
a0bbec8
to
aec3677
Compare
c86fd7c
to
130d760
Compare
@thisconnect thanks :) PTAL, I added a comment regarding the |
c09a10d
to
7945bc3
Compare
7945bc3
to
bff9192
Compare
@thisconnect followed your suggestions and removed the |
bff9192
to
752fceb
Compare
not sure why CI fails, running |
not related to your PR, we have a new script that checks for missing placeholders in translations 3d34cb6 bitbox-wallet-app/scripts/ci.sh Line 35 in 2a2e2b8
master was failing for a while as some placeholders in translations were missing, but it should pass since #2794 |
@thisconnect actually it was a different error, some transient backend/handler test failed for some reason. Re-run was successful. |
oups I just assumed and didn't check 😇 sorry |
752fceb
to
cc02956
Compare
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.
cc @shonsirsha can you take this review?
this.setState(currentState => { | ||
if (aopp?.state === 'choosing-account' | ||
useEffect(() => { | ||
setAccountCodeDefault(aopp, setAccountCode); |
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.
looking at the git diff setAccountCodeDefault is confusing me a bit and seems to work differently now.
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.
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 can put it back into the component so it does not need any arguments, I just like the functional style more for some reason but I think it does not really have any impact on anything here (e.g. performance)
cc02956
to
2b341d3
Compare
2b341d3
to
9355274
Compare
9355274
to
c44e83c
Compare
Sorry just saw this! Yes, I can. 👍 @NicolaLS , feel free to tag me as a reviwer once it's ready to be re-reviewed 😇 ty |
c44e83c
to
9b450b4
Compare
@shonsirsha Thanks, yes it is ready (just rebased) |
9b450b4
to
a7342ca
Compare
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.
<Message type="error"> | ||
<Cancel className={styles.smallIcon} /> | ||
{t(`error.${aopp.errorCode}`, { host: domain(aopp.callback) })} | ||
</Message> |
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.
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.
} | ||
|
||
type Props = TranslateProps; | ||
const setAccountCodeDefault = ( |
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 don't see a strong reason why we want to have this outside of the component. It doesn't seem to follow usual code pattern (setting state outside of the component itself).
The Aopp component also gets a lot shorter with this refactor - and having this fn in the component doesn't seem bad at all? :)
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.
true, I generally like a more functional approach so the dependencies are clear, also technically this improves performance because the function is not defined/initialized on every render but performance does not really matter here xd.
I'm going to put it back in the component
a7342ca
to
0780ae2
Compare
0780ae2
to
3278504
Compare
(addressed change requests in interactive rebase, might add a commit to remove |
@shonsirsha thanks, I addressed everything PTAL.
I searched for |
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.
LGTM, thanks!
Tested by patching the
Start
function inbackend
like this.I actually forgot to remove the commit, but I guess it is good to leave it in there for reviewers to test the PR. I can remove it in the end. (note the delay is 15 seconds when testing).removed it now.I tested on
webdev
firefox with BB02B keystore andservewallet-mainnet
. I tested the followingcase
statements form the return:error
inactive
user-approval
awaiting-keystore
signing
I think
choosing-account
andsyncing
was tested too and looked fine but it was to fast to take a screenshot.I think I did not test
success
because I don't know a callback to test aopp with.Some pictures from testing: