Skip to content

Commit

Permalink
Fix AnimatePresence won't unmount fastly changing content
Browse files Browse the repository at this point in the history
  • Loading branch information
JaeSeoKim committed Jun 3, 2022
1 parent ff0a210 commit f435b02
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,9 @@ function onlyElements(children: ReactNode): ReactElement<any>[] {
*
* @public
*/
export const AnimatePresence: React.FunctionComponent<React.PropsWithChildren<AnimatePresenceProps>> = ({
export const AnimatePresence: React.FunctionComponent<
React.PropsWithChildren<AnimatePresenceProps>
> = ({
children,
custom,
initial = true,
Expand All @@ -95,7 +97,7 @@ export const AnimatePresence: React.FunctionComponent<React.PropsWithChildren<An
const filteredChildren = onlyElements(children)
let childrenToRender = filteredChildren

const exiting = new Set<ComponentKey>()
const exiting = useRef(new Set<ComponentKey>()).current

// Keep a living record of the children we're actually rendering so we
// can diff to figure out which are entering and exiting
Expand Down

0 comments on commit f435b02

Please sign in to comment.