Skip to content

Nest modal reopening logic#976

Draft
emilydrakesmith wants to merge 2 commits intodevelopfrom
nest-modal-reopening-logic
Draft

Nest modal reopening logic#976
emilydrakesmith wants to merge 2 commits intodevelopfrom
nest-modal-reopening-logic

Conversation

@emilydrakesmith
Copy link
Contributor

Changes to the useModal Hook

  • arguments are accepted through an args config object
  • all instantiations are updated to use this format
  • now accepts canReopen as a boolean to gatekeep re-opening

Old format:

// controller to prevent re-opening of modal
const [canOpen, setCanOpen] = useState<boolean>(true);
// instantiate modal controls, closed at render by default 
const myModal = useModal('closed');
// fn to open the modal which respects gatekeeping
function openModal(): void {
    if (canOpen) {
        setCanOpen('false');
        myModal.open();
    }
}

New format:

// option 1, specify all values explicitly
const MODAL_CONFIG = {
    defaultState: 'closed',
    canReopen: 'false',
};
const myModal = useModal(MODAL_CONFIG);

// option 2: only set values to override defaults
const myModal = useModal({ canReopen: false }):

To call with all default values:

const myModal = useModal();

@emilydrakesmith emilydrakesmith self-assigned this Feb 9, 2026
@emilydrakesmith emilydrakesmith added the dev tooling feature will ease future development label Feb 9, 2026
@netlify
Copy link

netlify bot commented Feb 9, 2026

Deploy Preview for ambi-perps ready!

Name Link
🔨 Latest commit 89976fd
🔍 Latest deploy log https://app.netlify.com/projects/ambi-perps/deploys/698a4c0fb154dd00088f2825
😎 Deploy Preview https://deploy-preview-976--ambi-perps.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@netlify
Copy link

netlify bot commented Feb 9, 2026

Deploy Preview for ambi-perps-us ready!

Name Link
🔨 Latest commit 89976fd
🔍 Latest deploy log https://app.netlify.com/projects/ambi-perps-us/deploys/698a4c0facfca200080d8f4f
😎 Deploy Preview https://deploy-preview-976--ambi-perps-us.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@emilydrakesmith emilydrakesmith marked this pull request as draft February 9, 2026 21:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dev tooling feature will ease future development

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant