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

chore(deps): update dependency material-ui-confirm to v4 - autoclosed #173

Closed
wants to merge 1 commit into from

Conversation

renovate[bot]
Copy link
Contributor

@renovate renovate bot commented Feb 5, 2025

This PR contains the following updates:

Package Change Age Adoption Passing Confidence
material-ui-confirm ^3 -> ^4.0.0 age adoption passing confidence

Release Notes

jonatanklosko/material-ui-confirm (material-ui-confirm)

v4.0.0

Compare Source

This release changes the API, affecting all usages of confirm function. Previously the promise returned by confirm would be resolved on confirm and rejected on cancel. This has changed and the promise is now always resolved ⚠️.

You can upgrade to the new version and maintain the previous behaviour by setting a provider attribute:

<ConfirmProvider useLegacyReturn>
  {/* ... */}
</ConfirmProvider>
Migrating

Given this code from v3:

confirm({ ... })
  .then(() => console.log("confirm"))
  .catch(() => console.log("cancel"));

You can achieve the same behaviour in v4, like so:

confirm({ ... })
  .then(({ confirmed, reason }) => {
    if (confirmed) {
      console.log("confirm")
    } else if (reason === "cancel") {
      console.log("cancel")
    }
  });

The promise is also resolved on natural close (backdrop click, escape) or when the parent unmounts, in both cases with a distinct reason. In most cases you may only be interested in the confirmed code path, in which case you would only check confirmed and ignore the reason.

With this new API, it is guaranteed the callback eventually runs, which helps to avoid leaks if the callback is supposed to free certain resources. It is also more suitable for use with async/await (which required a try/catch):

const { confirmed } = await confirm({ description: "This action is permanent!" });

if (confirmed) {
  /* ... */
}

Breaking changes

  • Always resolve the promise with confirmation status and close reason (#​124)

Configuration

📅 Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.

Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 Ignore: Close this PR and you won't be reminded about this update again.


  • If you want to rebase/retry this PR, check this box

This PR was generated by Mend Renovate. View the repository job log.

@renovate renovate bot changed the title chore(deps): update dependency material-ui-confirm to v4 chore(deps): update dependency material-ui-confirm to v4 - autoclosed Feb 5, 2025
@renovate renovate bot closed this Feb 5, 2025
@renovate renovate bot deleted the renovate/material-ui-confirm-4.x branch February 5, 2025 14:04
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.

1 participant