Closed jgjgill closed 4 months ago
You’re correct in your observation.
To explain the background of this implementation: initially, during the PoC (Proof of Concept) phase of this library, the add and open steps of the reducer were combined into a single step, and similarly, the close and unmount steps were combined into one.
As a result, calling closeAll would trigger unmountAll immediately afterwards. In very specific scenarios, we noticed an issue where the animation would break. To temporarily fix this, we found that setting the current value helped resolve the issue.
To properly address this animation issue, we later decided to separate the add and open steps, as well as the close and unmount steps.
In other words, now that the close and unmount steps are separated, there’s no longer a need for the current value to point to the last modal. We will update this to point to null instead.
The part you mentioned about overlayId potentially being an empty string was not intentional. It could lead to bugs.
The possibility of overlayId being an empty string could arise when a custom ID is specified. We need to prevent setting an empty string as a custom ID.
Oh, Thank you for your detailed explanation! I now have a better understanding of the library. 🙇♂️
Hi, I'm learning a lot from your code. I have a question.
I think when I use
unmountAll
, theoverlays
value is to be initialoverlays
value. But nowoverlays.current
isstate.current
.Test
I proceeded with the test as follows.
store.ts
temp test code
I checked the following console. 🧐
Suggestion
In my opinion, the following code should be changed
state.current
=>null
reducer.ts
Thanks for the great library.