-
Notifications
You must be signed in to change notification settings - Fork 17
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
Add RPC selection to onboarding flow #868
Conversation
fe48dd9
to
6a956dd
Compare
await finalOnboardingSave(password); | ||
navigate(PagePath.ONBOARDING_SUCCESS); | ||
await onboardingSave(password); | ||
navigate(PagePath.SET_RPC_ENDPOINT); |
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.
Note that I didn't make this change in the RestorePassword
component. It doesn't seem to be part of the onboarding flow, and I actually am unclear on if that component is actually used anywhere?
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.
Feel free to delete it. It's unused for like 8 months.
5a8d317
to
1705365
Compare
5d6587a
to
10efebb
Compare
82b4c69
to
412d3b3
Compare
* </SelectList> | ||
* ``` | ||
*/ | ||
export const SelectList = ({ children }: { children: ReactNode }) => ( |
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.
@@ -0,0 +1,66 @@ | |||
import type { Meta, StoryObj } from '@storybook/react'; |
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.
const handleSubmit = async (e: FormEvent<HTMLFormElement>) => { | ||
e.preventDefault(); | ||
await setGrpcEndpointInZustand(grpcEndpoint); | ||
void chrome.runtime.sendMessage(ServicesMessage.OnboardComplete); |
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.
@turbocrime please confirm that this is correct (moving OnboardComplete
) to this step, since this is the new last step of onboarding.
await finalOnboardingSave(password); | ||
navigate(PagePath.ONBOARDING_SUCCESS); | ||
await onboardingSave(password); | ||
navigate(PagePath.SET_RPC_ENDPOINT); |
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.
Feel free to delete it. It's unused for like 8 months.
const randomlySortedEndpoints = useMemo(() => [...RPC_ENDPOINTS].sort(randomSort), []); | ||
const [grpcEndpoint, setGrpcEndpoint] = useState(randomlySortedEndpoints[0]!.url); | ||
const setGrpcEndpointInZustand = useStore(state => state.network.setGRPCEndpoint); | ||
const customRpcEndpointInput = useRef<HTMLInputElement | null>(null); |
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.
What do you think about moving all this logic into zustand with an RPC slice? My hunch is perhaps we'd want to re-use this within our settings tab in the extension and moving the logic out likely makes this easier.
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 also reduces the redundancies with setGrpcEndpointInZustand
& setGrpcEndpoint
onSelect={() => { | ||
if (!isCustomRpcEndpoint) setGrpcEndpoint(''); |
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.
Can we do some validation like the way we do in settings right now? If it cannot connect to the grpc url, we do not allow it to be set.
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.
Going to take the liberty of doing this (and addressing your comment above about moving logic into Zustand) in a separate PR, since it looks like that'll require some (necessary) refactoring that I was anyway going to do when adding a similar RPC selection form to the extension's settings page.
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.
Left some comments, think there are some areas it would be helpful to add to
screencap.mov
In this PR
addListener
/removeListener
methods toExtensionStorage
, so that we can wait to make requests until thegrpcEndpoint
property exists in extension storage.Next PR
Relates to #605