-
-
Notifications
You must be signed in to change notification settings - Fork 234
fix(Modal): replace deprecated maskClosable with mask.closable #481
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -32,7 +32,7 @@ export const RawModalStackItem = memo( | |||||||||||||||
| const close = useEventCallback(() => stableOnClose(id)); | ||||||||||||||||
|
|
||||||||||||||||
| const setCanDismissByClickOutside = useEventCallback((value: boolean) => { | ||||||||||||||||
| onUpdate(id, { maskClosable: value }); | ||||||||||||||||
| onUpdate(id, { mask: { closable: value } }); | ||||||||||||||||
|
||||||||||||||||
| onUpdate(id, { mask: { closable: value } }); | |
| const currentMask = props['mask']; | |
| const nextMask = | |
| currentMask && typeof currentMask === 'object' | |
| ? { ...(currentMask as Record<string, unknown>), closable: value } | |
| : { closable: value }; | |
| onUpdate(id, { mask: nextMask }); |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -232,7 +232,7 @@ export const createModal = (props: ImperativeModalProps): ModalInstance => { | |
| return { | ||
| close: () => closeModal(id), | ||
| destroy: () => destroyModal(id), | ||
| setCanDismissByClickOutside: (value) => updateModal(id, { maskClosable: value }), | ||
| setCanDismissByClickOutside: (value) => updateModal(id, { mask: { closable: value } }), | ||
|
||
| update: (nextProps) => updateModal(id, nextProps), | ||
| }; | ||
| }; | ||
|
|
@@ -271,7 +271,7 @@ export function createRawModal<P, OpenKey extends keyof P, CloseKey extends keyo | |
| return { | ||
| close: () => closeModal(id), | ||
| destroy: () => destroyModal(id), | ||
| setCanDismissByClickOutside: (value) => updateRawProps(id, { maskClosable: value }), | ||
| setCanDismissByClickOutside: (value) => updateRawProps(id, { mask: { closable: value } }), | ||
|
||
| update: (nextProps) => updateRawProps(id, nextProps as Record<string, unknown>), | ||
| }; | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
onUpdateultimately shallow-merges modal props inupdateModal. Passingmask: { closable: value }here will overwrite any existingmaskconfiguration on the imperative modal (dropping other mask fields). Consider updating the merge logic (or this update payload) so onlymask.closableis changed while preserving othermaskproperties.