Skip to content
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

show detail after proxy check #197

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 13 additions & 4 deletions src/hooks/useProxy.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ const initialState = {
startingBlockHeight: 0,
proxyAddress: undefined,
startedWithoutProxy: false,
proxyDeployed: false
proxyDeployed: false,
savePageProxyCheckState: false
};

export default function useProxy() {
Expand All @@ -28,7 +29,8 @@ export default function useProxy() {
startingBlockHeight,
proxyAddress,
startedWithoutProxy,
proxyDeployed
proxyDeployed,
savePageProxyCheckState
},
updateState
] = useReducer(
Expand Down Expand Up @@ -64,12 +66,18 @@ export default function useProxy() {
(async () => {
updateState({ initialProxyCheck: true });
const proxyAddress = await maker.service('proxy').getProxyAddress();
if (isCancelled) return;
if (isCancelled) {
updateState({
savePageProxyCheckState: true
});
return;
}
log(`got proxy address: ${proxyAddress}`);
updateState({
initialProxyCheck: false,
proxyAddress,
startedWithoutProxy: !proxyAddress
startedWithoutProxy: !proxyAddress,
savePageProxyCheckState: true
});
})();
}
Expand All @@ -86,6 +94,7 @@ export default function useProxy() {
startedWithoutProxy,
startingBlockHeight,
proxyDeployed,
savePageProxyCheckState,
hasProxy: startedWithoutProxy ? proxyDeployed : !!proxyAddress
};
}
9 changes: 7 additions & 2 deletions src/pages/Save.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,12 @@ function Save() {
const { account, network } = useMaker();
const [{ savings }] = useStore();

const { proxyAddress, hasProxy, proxyLoading } = useProxy();
const {
proxyAddress,
hasProxy,
proxyLoading,
savePageProxyCheckState
} = useProxy();
const { trackBtnClick } = useAnalytics('DsrView');

const { events, isLoading } = FeatureFlags.FF_DSR_HISTORY
Expand Down Expand Up @@ -59,7 +64,7 @@ function Save() {
<PageContentLayout>
{!account ? (
<AccountSelection />
) : proxyLoading && !hasProxy ? (
) : (proxyLoading && !hasProxy) || !savePageProxyCheckState ? (
<LoadingLayout />
) : !hasProxy && showOnboarding ? (
<Flex
Expand Down