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

fix: improve Earn transaction success state #1973

Merged
merged 12 commits into from
Feb 13, 2025
Merged

fix: improve Earn transaction success state #1973

merged 12 commits into from
Feb 13, 2025

Conversation

dschlabach
Copy link
Contributor

What changed? Why?
This PR includes several quality of live improvements:

  • Improve success state after deposits/withdrawals by showing the amount deposited / withdrawn in the button
  • Surfaces warnings related to invalid vault addresses passed to <Earn />
  • Adds a title attribute to truncated elements

DS 2025-02-12 at 10 23 25@2x

Notes to reviewers

How has it been tested?

Copy link

vercel bot commented Feb 12, 2025

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

Name Status Preview Comments Updated (UTC)
onchainkit-coverage ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 13, 2025 3:30pm
onchainkit-playground ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 13, 2025 3:30pm
onchainkit-routes ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 13, 2025 3:30pm

@dschlabach dschlabach changed the title fix: improve transaction success state fix: improve Earn transaction success state Feb 12, 2025
* @param durationMs - Duration in milliseconds before the value resets
* @returns [value, setValue] - Current value and setter function
*/
export function useTemporaryValue<T>(
Copy link
Contributor

Choose a reason for hiding this comment

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

Just curious what the use case for this is

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good call, was for a previous implementation, I'll delete it.

@@ -11,7 +11,7 @@ function EarnWithdrawDefaultContent() {
<EarnDetails />
<WithdrawAmountInput />
<WithdrawBalance />
<WithdrawButton className="h-12" />
<WithdrawButton className="-mt-4 h-12" />
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: I just feel like we shouldn't be updating the component through classNames here. And we should directly change inside the WithdrawButton component?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

discussed offline 👍🏻

cpcramer
cpcramer previously approved these changes Feb 13, 2025
throw new Error(
'Vault not found. Ensure the address is a valid Morpho vault on Base.',
);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

should this throw a generic error on any other error?

setLifecycleStatus({
statusName: 'reset',
statusData: null,
});
Copy link
Contributor

Choose a reason for hiding this comment

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

should this just reset to init?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah I can remove it, I guess there's no real value in a reset

}, [receipt]);
if (resetAfter) {
// Reset all internal state
const timeoutId = setTimeout(() => {
Copy link
Contributor

Choose a reason for hiding this comment

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

does this need to be handled in getTransactionLegacyReceipts too?

@dschlabach dschlabach merged commit 2572548 into main Feb 13, 2025
16 checks passed
@dschlabach dschlabach deleted the dms/earn-warn branch February 13, 2025 17:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants