Skip to content

feat(core): add options.logout.confirm for logout confirmation dialog#7405

Open
Amaanghazi22 wants to merge 3 commits into
refinedev:mainfrom
Amaanghazi22:feat/logout-confirmation
Open

feat(core): add options.logout.confirm for logout confirmation dialog#7405
Amaanghazi22 wants to merge 3 commits into
refinedev:mainfrom
Amaanghazi22:feat/logout-confirmation

Conversation

@Amaanghazi22

@Amaanghazi22 Amaanghazi22 commented Apr 26, 2026

Copy link
Copy Markdown

PR Checklist

Please check if your PR fulfills the following requirements:

Bugs / Features

Related issue: N/A (UX improvement proposal)

What is the current behavior?

Clicking logout in the sider or header immediately logs the user out with no confirmation. Users can accidentally log out while navigating.

What is the new behavior?

A new logout.confirm option can be set in <Refine options={{ logout: { confirm: true } }}>. When enabled, a confirmation dialog is shown before logout executes. Defaults to false — no breaking change.

Notes for reviewers

This is a UX improvement. The option defaults to false so existing behavior is fully preserved.

  • antd sider uses Modal.confirm (consistent with Ant Design patterns)
  • mui sider uses window.confirm (can be upgraded to a MUI dialog if preferred)
  • The example app-crm-minimal demonstrates the feature end-to-end

Happy to add tests, docs, and a changeset if maintainers want to move forward.

Adds a new `logout.confirm` option to Refine options that shows a
confirmation dialog before executing logout. Defaults to false to
preserve existing behavior.

- core: add `logout.confirm` to IRefineOptions type and defaults
- antd: ThemedSider shows Modal.confirm when logout.confirm is true
- mui: ThemedSider shows window.confirm when logout.confirm is true
@changeset-bot

changeset-bot Bot commented Apr 26, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: dabe0c4

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@refinedev/chakra-ui Patch
@refinedev/mantine Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

/**
* Configure logout behavior across all Refine UI packages.
*/
logout?: {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Overall this looks like a useful addition. However, I think it needs either broader UI package coverage or narrower wording for the core option.

The new IRefineOptions.logout comment says that it configures logout behavior "across all Refine UI packages", but this PR only wires logout.confirm into the Ant Design and MUI ThemedSider implementations. The default Chakra UI and Mantine siders also call useLogout() directly, so
<Refine options={{ logout: { confirm: true } }}>
would behave differently depending on which UI package the app uses.

Could you either add the same confirm handling to
packages/chakra-ui/src/components/themedLayout/sider/index.tsx
and packages/mantine/src/components/themedLayout/sider/index.tsx,
or scope the option/docs to the UI packages implemented in this PR?
Since these packages already use the shared layoutSiderTests, a shared logout-confirm test there would also help prevent this behavior from drifting between UI integrations.

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