We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
overlay
tanstack query
useMutate()
(isIdle, isPending, isError)
<IconButton onClick={() => { overlay.open(({ isOpen, unmount }) => { return ( <Confirm.Root open={isOpen} onOpenChange={unmount}> <Confirm.Content> {(() => { if (isIdle) { return ( <Confirm.Title> 파일을 삭제하시겠어요? </Confirm.Title> ); } // 리렌더링 되지 않음 ❌ if (isPending) { return ( <Confirm.Title> 파일을 삭제중입니다. </Confirm.Title> ); } // 리렌더링 되지 않음 ❌ if (isError) { return ( <Confirm.Title> {error.message} </Confirm.Title> ); } })()} </Confirm.Content> <Confirm.Actions> <Confirm.Dismiss onClick={unmount}> 아니오 </Confirm.Dismiss> <Confirm.Ok onClick={() => { mutate( undefined, { onSuccess: () => { reset(); unmount(); }, onError: () => { // }, }, ); }} > 예 </Confirm.Ok> </Confirm.Actions> </Confirm.Root> ); }); }} > <div className={css({ bg: "semantic.bg.contents", color: "semantic.icon.defaultAssist", borderRadius: "semantic.radii.full", })} > <Icon iconName="x" size="sm" /> </div> </IconButton>
The text was updated successfully, but these errors were encountered:
overlay-kit은 쉽게 말해서 오버레이가 열릴 때, 스냅샷을 찍어서 컴포넌트 내부 상태로 저장하는 형태로 동작합니다. 따라서 동적인 props를 인지할 수 없습니다.
동적 props를 처리하는 데 여러 옵션이 있습니다.
mantine ui의 modals manager는 overlay-kit과 유사한 방식으로 동작하며, 동일한 이슈가 있습니다: mantinedev/mantine#751 (comment)
Sorry, something went wrong.
No branches or pull requests
질문
overlay
에서 상태가 변경되어도 리렌더링이 되지 않습니다. 구조적으로 이것을 구현하는 것은 불가능한가요?예시코드
tanstack query
의useMutate()
를 사용하여 post 요청을 보내고, 요청 상태(isIdle, isPending, isError)
에 따라 각각 다른 UI를 표시하고자 합니다.기대 결과
실행 결과
The text was updated successfully, but these errors were encountered: