Problem with nested NiceModal Provider
Open
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 2.3k
- Forks
- 127
- PR merge metrics
- No merged PRs in 30d
Description
Steps to reproduce
- Wrap the whole app with a NiceModal.Provider
- Then use react-router or simple state to create 2 page
- On page 1 use NiceModal.Provider to wrap all children
- Add a button and simple Modal for page 1
- On page 2 don't wrap it with a NiceModal.Provider
- Add a button and simple Modal for page 2
- Add buttons to switch between pages
- Start the app
Case 1:
- Go to page 1 directly then click the button to open the dialog -> it works
- Go to page 2 by clicking the button we add in step 7 above then click the button to open the dialog -> it doesn't work
Case 2:
- Go to page 2 directly then click the button to open the dialog -> it works
- Go to page 1 by clicking the button we add in step 7 then click the button to open the dialog -> it works
- Go to page 2 by clicking the button we add in step 7 then click the button to open the dialog -> it doesn't work
Github repository
https://github.com/quangphuchuynh95/test-nice-modal
Codesandbox
https://codesandbox.io/s/wizardly-goldberg-rp3vtz?file=/src/index.js
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the nested-provider behavior in the linked GitHub repository or CodeSandbox, following the two cases described in the issue. Trace how page transitions and NiceModal.Provider nesting affect modal opening; done means dialogs open consistently on both pages regardless of navigation order.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- react, typescript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100