-
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
Stop using loader functions for swap page #1316
Stop using loader functions for swap page #1316
Conversation
|
eaa38b3
to
dd22cc6
Compare
@jessepinho can you fold in this comment to reduce code duplication and have the warning use our shiny new zquery loaders? |
e69f8f1
to
ca1b276
Compare
c8bb4a6
to
0e2be0a
Compare
0e2be0a
to
447cbb8
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.
Not strictly related to this PR, just something I noticed while working on it
useStore.getState().swap.setAssetIn(balancesResponses[0]); | ||
useStore.getState().swap.setAssetOut(swappableAssets[0]!); |
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.
These two set*
calls are now made in the ZQuery object's fetch
function.
if (balancesResponses[0]) { | ||
useStore.getState().swap.setAssetIn(balancesResponses[0]); | ||
useStore.getState().swap.setAssetOut(swappableAssets[0]!); | ||
useStore.getState().swap.setStakingAssetMetadata(stakingTokenAssetMetadata); |
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 now accessed via useStakingTokenMetadata
useStore.getState().swap.setBalancesResponses(balancesResponses); | ||
useStore.getState().swap.setSwappableAssets(swappableAssets); |
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.
These are now ZQuery objects
<AssetSelector assets={swappableAssets} value={assetOut} onChange={setAssetOut} /> | ||
{assetOut && <BalanceValueView valueView={assetOutBalance} />} | ||
</div> | ||
<FadeIn condition={!!balancesResponses.data && !!swappableAssets.data}> |
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.
Can we handle the error case as well? Maybe some red text with a loading error 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.
done
// State to manage privacy warning display | ||
const [showNonNativeFeeWarning, setshowNonNativeFeeWarning] = useState(false); | ||
const [showNonNativeFeeWarning, setShowNonNativeFeeWarning] = useState(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.
typo fix
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
<AssetSelector assets={swappableAssets} value={assetOut} onChange={setAssetOut} /> | ||
{assetOut && <BalanceValueView valueView={assetOutBalance} />} | ||
</div> | ||
<FadeIn condition={!!balancesResponses.data && !!swappableAssets.data}> |
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 handle the error case as well? Maybe some red text with a loading error message?
e3e05f8
to
8c45d66
Compare
Ah, sure — but I'm going to do that as a separate super-small PR, since as part of that, I want to calculate |
This PR removes the loader function from the swap route, and instead uses ZQuery, resulting in instant route changes when a user navigates to
/swap
.Closes #1243