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

feat: Improve ExpirationTimePicker component #7782

Merged
merged 7 commits into from
Jan 25, 2024

Conversation

evavirseda
Copy link
Collaborator

@evavirseda evavirseda commented Dec 13, 2023

Summary

Partialy resolves the issue #7710, mainly this part:

There is some "remember previous value" logic in the component that causes bugs. Case found by Branko in the Refactor send flow PR (#7608)

We can open a new issue for expiration timepicker improvement because it would be a big refactor

Close #7710

...

Changelog

- Remove unnecessary prop (initialSelected)
- Cleanup code

Testing

Platforms

Please select any platforms where your changes have been tested.

  • Desktop
    • MacOS
    • Linux
    • Windows

Instructions

Please describe the specific instructions, configurations, and/or test cases necessary to test and verify that your changes work as intended.

...

Checklist

Please tick the following boxes that are relevant to your changes.

  • I have followed the contribution guidelines for this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added or modified tests that prove my changes work as intended
  • I have verified that new and existing unit tests pass locally with my changes
  • I have verified that my latest changes pass CI workflows for testing and linting
  • I have made corresponding changes to the documentation

@brancoder brancoder self-requested a review December 18, 2023 13:29
Copy link
Collaborator

@brancoder brancoder left a comment

Choose a reason for hiding this comment

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

There are a lot of moving parts in the ExpirationTimePicker:

  • Toggling giftStoragDeposit Button
  • Setting Date to expiration time picker initially and also when returning from unlock stronghold popup
  • be cautious to not rebuildTransactionOutput if not intended by changing expiration date

In regards to this part of the issue:

There is some "remember previous value" logic in the component that causes bugs. Case found by Branko in the Refactor send flow PR (#7608)

In the original code this can be fix with this change to the setNull function:

export function setNull(bool: boolean): void {
        if (bool && value) {
            storedValue = value
            value = null
            previouslySelectedPeriod = selectedTimePeriod
            selectedTimePeriod = TimePeriod.None
        } else {
            value = storedValue ?? value
            selectedTimePeriod = previouslySelectedPeriod
        }
    }

setNull was used when toggling giftStorageDeposit button but it wasn't tracking and resetting all the variables correctly.

Copy link
Collaborator

@brancoder brancoder left a comment

Choose a reason for hiding this comment

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

Reverted changes and added a fix for "remember previous value" from this issue #7710

@evavirseda
Copy link
Collaborator Author

Reverted changes and added a fix for "remember previous value" from this issue #7710

LGTM!

Copy link
Member

@cpl121 cpl121 left a comment

Choose a reason for hiding this comment

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

LGTM

@begonaalvarezd begonaalvarezd merged commit ca652cd into develop Jan 25, 2024
4 checks passed
@begonaalvarezd begonaalvarezd deleted the feat/improve-expirationTimePicker-component branch January 25, 2024 16:50
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.

[Task]: Improve ExpirationTimePicker component
4 participants