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

Keep fromToken when switching swap option #234

Open
wants to merge 2 commits into
base: trs
Choose a base branch
from

Conversation

rogue-hacker
Copy link
Contributor

No description provided.

@vercel
Copy link

vercel bot commented Nov 25, 2022

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated
perpetual-swaps ✅ Ready (Inspect) Visit Preview Nov 30, 2022 at 11:53PM (UTC)

@rogue-hacker
Copy link
Contributor Author

@dospore

Comment on lines -1647 to -1648
setFromValue("");
setToValue("");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

surely these have to remain the same if there arent any other changes?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These two lines clear the value - Kurt requested that the value be retained across swap options, so by removing these the value stays the same

@rogue-hacker rogue-hacker requested a review from dospore November 29, 2022 23:42
src/components/Exchange/SwapBox.js Outdated Show resolved Hide resolved
Comment on lines +1649 to +1650
const updatedTokenSelection = JSON.parse(JSON.stringify(tokenSelection));
updatedTokenSelection[opt].from = prevTokenAddress;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we need to stringify then parse? could we just do { ...tokenSelection } if you wanted to shallow clone?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes we do, as the value is stored not only in state but in localStorage

src/components/Exchange/SwapBox.js Show resolved Hide resolved
@dospore dospore self-requested a review November 30, 2022 23:40
Copy link
Contributor

@dospore dospore left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved but not sure if kurtis wants us to push new updates to FE

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants