-
Notifications
You must be signed in to change notification settings - Fork 5k
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
Alert user upon switching to unconnected account #8312
Conversation
29aa4d0
to
256e2b1
Compare
This method adds the given account to the given origin's list of exposed accounts. This method is not yet used, but it will be in subsequent PRs (e.g. #8312) This method has been added to the background API, and a wrapper action creator has been written as well.
81a5e72
to
50c0166
Compare
256e2b1
to
fa1846d
Compare
I'll wait on #8345 before fixing the broken integration tests, as I'll have one less state file to modify after that's merged. |
fa1846d
to
8a90007
Compare
Builds ready [8a90007]
Page Load Metrics (650 ± 37 ms)
|
50c0166
to
86acf73
Compare
8a90007
to
54d525c
Compare
Builds ready [54d525c]
Page Load Metrics (669 ± 46 ms)
|
86acf73
to
0c969dc
Compare
54d525c
to
918706e
Compare
Builds ready [918706e]
Page Load Metrics (660 ± 54 ms)
|
This method adds the given account to the given origin's list of exposed accounts. This method is not yet used, but it will be in subsequent PRs (e.g. #8312) This method has been added to the background API, and a wrapper action creator has been written as well.
0c969dc
to
3970922
Compare
918706e
to
896ff3b
Compare
Builds ready [896ff3b]
Page Load Metrics (695 ± 31 ms)
|
This method adds the given account to the given origin's list of exposed accounts. This method is not yet used, but it will be in subsequent PRs (e.g. #8312) This method has been added to the background API, and a wrapper action creator has been written as well.
896ff3b
to
22d9a13
Compare
Builds ready [22d9a13]
Page Load Metrics (685 ± 56 ms)
|
7b02acc
to
08e71d0
Compare
f60f9a1
to
48af2bc
Compare
Builds ready [48af2bc]
|
48af2bc
to
928734a
Compare
Builds ready [928734a]
|
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.
Very clean and crisp! A pleasure to review. Excited to see Immer being used, even if indirectly.
One in-line comment, and also some feedback about styling/UX:
- The buttons appear disproportionately large to me, relative to the size of the popover. Could we make them smaller?
- Related: Where are the designs?
- In testing this, I quickly got very annoyed with this popup. Can we add a "Don't show this again" checkbox?
Yeah, the buttons do look a bit large. I think those sizes are being dictated by our default button styles? I'll take a look. We have another card for updating the button styles across the extension to be rounded, as shown in the Figma designs, but that wasn't going to be in v8. Maybe I can tweak them to be a bit smaller though. The designs are here. The "Don't show this again" checkbox was going to be in a follow-up PR; there's a separate card for that on Trello I believe. |
@Gudahtt word, sounds good! Just me when you've decided what to do with the button styles. Oh one more thing: doing any e2e tests for this in a follow-up, or what's the plan for that? |
d9e0349
to
4495c2a
Compare
Builds ready [4495c2a]
Page Load Metrics (672 ± 37 ms)
|
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!
Buttons and checkbox can be fixed in one or more follow-up PRs.
4495c2a
to
f83340c
Compare
Two updates have been made:
|
@rekmarks I started trying to write an e2e test for this, but it was a bit challenging because we can't actually test the real popup with Selenium. It doesn't allow interacting with browser-things outside of the page (even the keyboard shortcut is intercepted). Even if it did allow it, there's no way to focus on the popup either. In other tests we fake the popup UI by navigating to |
Builds ready [f83340c]
Page Load Metrics (666 ± 41 ms)
|
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!
Nice fix for the buttons and selected address state.
An alert is now shown when the user switches from an account that is connected to the active tab to an account that is not connected. The alert prompts the user to dismiss the alert or connect the account they're switching to. The "loading" state is handled by disabling the buttons, and the error state is handled by displaying a generic error message and disabling the connect button. The new reducer for this alert has been created with `createSlice` from the Redux Toolkit. This utility is recommended by the Redux team, and represents a new style of writing reducers that I hope we will use more in the future (or at least something similar). `createSlice` constructs a reducer, actions, and action creators automatically. The reducer is constructed using their `createReducer` helper, which uses Immer to allow directly mutating the state in the reducer but exposing these changes as immutable.
The `unconnected-account` reducer no longer caches the selected address when the alert was opened. Instead a new event was added for when the selected address changes (`SELECTED_ADDRESS_CHANGED`). Now that we know exactly when the selected address changes, we don't need to cache the original account for comparison anymore.
The buttons are now closer in size to the buttons in the designs. The button styles will be updated to match the designs more closely in a separate PR.
f83340c
to
0818023
Compare
Builds ready [0818023]
Page Load Metrics (649 ± 43 ms)
|
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.
Re-approve after rebase.
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 looks good to me! I didn't test it out locally but it looks like @rekmarks did.
An alert is now shown when the user switches from an account that is connected to the active tab to an account that is not connected. The alert prompts the user to dismiss the alert or connect the account they're switching to.
The "loading" state is handled by disabling the buttons, and the error state is handled by displaying a generic error message and disabling the connect button.
The new reducer for this alert has been created with
createSlice
from the Redux Toolkit. This utility is recommended by the Redux team, and represents a new style of writing reducers that I hope we will use more in the future (or at least something similar).createSlice
constructs a reducer, actions, and action creators automatically. The reducer is constructed using theircreateReducer
helper, which uses Immer to allow directly mutating the state in the reducer but exposing these changes as immutable.