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

MPP-3687 [Android] Delete mask modal not appearing always #4289

Merged
merged 2 commits into from
Jan 9, 2024
Merged

Conversation

lloan
Copy link
Contributor

@lloan lloan commented Jan 9, 2024

This PR fixes MPP-3687

New feature description

[Android] Delete mask modal not appearing always and deleting the mask immediately. This adds a check so that the onConfirm function checks if the modal is open.

const onConfirm: FormEventHandler = (event) => {
    event.preventDefault();

    if (modalState.isOpen) {
      props.onDelete();
      modalState.close();
    }
  };

Screenshot (if applicable)

Not applicable.

How to test

  1. Navigate to the Relay email mask dashboard;
  2. Generate a new email mask;
  3. Delete the email mask;
  4. Repeat steps 2-3 a few times and observe behaviour;

Expected result:

The delete mask modal appears whenever a user tries to delete a mask;

Incorrect result:

Intermittently, the modal does not appear and the mask is deleted instantly;

Checklist (Definition of Done)

  • Product Owner accepted the User Story (demo of functionality completed) or waived the privilege.
  • All acceptance criteria are met.
  • Jira ticket has been updated (if needed) to match changes made during the development process.
  • I've added or updated relevant docs in the docs/ directory
  • Jira ticket has been updated (if needed) with suggestions for QA when this PR is deployed to stage.
  • All UI revisions follow the coding standards, and use Protocol tokens where applicable (see /frontend/src/styles/tokens.scss).
  • Commits in this PR are minimal and have descriptive commit messages.
  • l10n changes have been submitted to the l10n repository, if any.

@lloan lloan requested a review from maxxcrawford January 9, 2024 02:12
@lloan lloan self-assigned this Jan 9, 2024
Copy link
Contributor

@maxxcrawford maxxcrawford left a comment

Choose a reason for hiding this comment

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

Nice fix!

Open-ended question for @Vinnl: I wonder if there's a larger refactor on how to handle this without adding the additional check inside the onConfirm event?

@say-yawn say-yawn added this pull request to the merge queue Jan 9, 2024
Merged via the queue into main with commit ab3c2a9 Jan 9, 2024
23 checks passed
@say-yawn say-yawn deleted the MPP-3687 branch January 9, 2024 18:41
@Vinnl
Copy link
Collaborator

Vinnl commented Jan 10, 2024

@maxxcrawford Hmm, I don't think I have enough context to answer. Looking at the change, it sounds like the onConfirm handler was being called while the dialog wasn't open - even though it's a submit handler for a form that's only visible inside the dialog? Presumably, to fix the root cause would require investigating why that callback was being called in the first place.

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.

4 participants