fix: only render modal when explicitly opened to prevent auto-show
Change modal rendering strategy from controlled via 'open' prop to
conditional rendering. Now the Modal component is only added to DOM
when isAddModalOpen is true, preventing it from being present on page load.
Before: {actions.addNew && <Modal open={isAddModalOpen} ...>}
After: {actions.addNew && isAddModalOpen && <Modal ...>}
This ensures the modal cannot accidentally show on page load and cannot be
interfered with when it shouldn't exist.
Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -1 +1 @@
|
||||
<?php return array('dependencies' => array('react', 'wp-components', 'wp-element', 'wp-i18n', 'wp-icons/build/arrow-left', 'wp-icons/build/bell', 'wp-icons/build/eye-closed', 'wp-icons/build/eye-opened', 'wp-icons/build/list', 'wp-icons/build/message', 'wp-icons/build/minus', 'wp-icons/build/trash', 'wp-icons/build/visible'), 'version' => 'b71d9ac468e7d4c01a3d');
|
||||
<?php return array('dependencies' => array('react', 'wp-components', 'wp-element', 'wp-i18n', 'wp-icons/build/arrow-left', 'wp-icons/build/bell', 'wp-icons/build/eye-closed', 'wp-icons/build/eye-opened', 'wp-icons/build/list', 'wp-icons/build/message', 'wp-icons/build/minus', 'wp-icons/build/trash', 'wp-icons/build/visible'), 'version' => '45054e0b1c710182ba92');
|
||||
|
||||
File diff suppressed because one or more lines are too long
BIN
node_modules/.cache/babel-loader/8cc6fe2d32e01bdb05f4edf32353fc7bcd4f833ddbb91198129c7c6962ce6dd8.json.gz
generated
vendored
Normal file
BIN
node_modules/.cache/babel-loader/8cc6fe2d32e01bdb05f4edf32353fc7bcd4f833ddbb91198129c7c6962ce6dd8.json.gz
generated
vendored
Normal file
Binary file not shown.
BIN
node_modules/.cache/babel-loader/acb512dd62b4aba9580d7caf58090f6363675a38a97ed270c522e81684d3a00c.json.gz
generated
vendored
Normal file
BIN
node_modules/.cache/babel-loader/acb512dd62b4aba9580d7caf58090f6363675a38a97ed270c522e81684d3a00c.json.gz
generated
vendored
Normal file
Binary file not shown.
@@ -531,17 +531,15 @@ export default function DataTable({
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* Add New Modal */}
|
||||
{actions.addNew && (
|
||||
{/* Add New Modal - only render when actually open */}
|
||||
{actions.addNew && isAddModalOpen && (
|
||||
<Modal
|
||||
title={actions.addNew.label || __('Add New', 'formipay')}
|
||||
open={isAddModalOpen}
|
||||
onRequestClose={() => {
|
||||
setIsAddModalOpen(false);
|
||||
setNewItemTitle('');
|
||||
}}
|
||||
isDismissible
|
||||
focusOnMount="firstContentElement"
|
||||
>
|
||||
<TextControl
|
||||
__next40pxDefaultSize
|
||||
|
||||
Reference in New Issue
Block a user