feat(core): add options.logout.confirm for logout confirmation dialog#7405
feat(core): add options.logout.confirm for logout confirmation dialog#7405Amaanghazi22 wants to merge 3 commits into
Conversation
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 detectedLatest commit: dabe0c4 The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
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?: { |
There was a problem hiding this comment.
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.
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.confirmoption 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.
Happy to add tests, docs, and a changeset if maintainers want to move forward.