diff --git a/src/components/modules/shared/CommentModal.tsx b/src/components/modules/shared/CommentModal.tsx index 90603eff71..6e35843793 100644 --- a/src/components/modules/shared/CommentModal.tsx +++ b/src/components/modules/shared/CommentModal.tsx @@ -1,5 +1,7 @@ import type { ModalContentComponent } from '~/components/ui/modal' +import { useCurrentModal } from '~/components/ui/modal' + import { CommentBoxRootLazy, CommentsLazy } from '../comment' export interface CommentModalProps { @@ -12,7 +14,8 @@ export interface CommentModalProps { export const CommentModal: ModalContentComponent = ( props, ) => { - const { refId, title, dismiss, initialValue } = props + const { refId, title, initialValue } = props + const { dismiss } = useCurrentModal() return (
@@ -24,7 +27,10 @@ export const CommentModal: ModalContentComponent = ( initialValue={initialValue} className="my-12" refId={refId} - afterSubmit={dismiss} + afterSubmit={() => { + // FIXME: framer motion bug, if re-render trigger and do dimiss same time, dom will don't remove after exit animation + setTimeout(dismiss, 1000) + }} /> diff --git a/src/components/ui/modal/stacked/provider.tsx b/src/components/ui/modal/stacked/provider.tsx index 7e35d780fa..44385dfbda 100644 --- a/src/components/ui/modal/stacked/provider.tsx +++ b/src/components/ui/modal/stacked/provider.tsx @@ -28,7 +28,7 @@ export const useModalStack = (options?: ModalStackOptions) => { return { present: useCallback( (props: ModalProps & { id?: string }) => { - const modalId = `${id}-${currentCount.current++}` + const modalId = `${id}-${++currentCount.current}` jotaiStore.set(modalStackAtom, (p) => { const modalProps = { ...props, @@ -82,7 +82,12 @@ const ModalStack = () => { useDismissAllWhenRouterChange() return ( - + { + console.log('onExitComplete') + }} + > {stack.map((item, index) => { return })}