Skip to content

Commit f666d25

Browse files
committed
πŸ› fix:ToastContainer λ Œλ”λ§ λ™μ‹œμ„± 이슈
- λ Œλ”λ§ 도쀑 toastλ₯Ό λ Œλ”λ§ν•˜λŠ” λ™μ‹œμ„± 이슈 문제λ₯Ό useTransition μ‚¬μš© Issue Resolved: #
1 parent f64cb3e commit f666d25

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

β€Žfront/src/components/Toast/ToastContainer.tsxβ€Ž

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { useEffect, useState } from 'react';
1+
import { useEffect, useState, useTransition } from 'react';
22

33
import Toast from '@/components/Toast/Toast.tsx';
44

@@ -14,14 +14,14 @@ interface ToastData {
1414

1515
export default function ToastContainer() {
1616
const [toastList, setToastList] = useState<ToastData[]>([]);
17-
17+
const [, startTransition] = useTransition();
1818
const getId = () => Date.now();
1919
const setSuccessToast = (text: string) =>
20-
setToastList((prev) => [{ type: 'success', text, id: getId() }, ...prev]);
20+
startTransition(() => setToastList((prev) => [{ type: 'success', text, id: getId() }, ...prev]));
2121
const setWarningToast = (text: string) =>
22-
setToastList((prev) => [{ type: 'warning', text, id: getId() }, ...prev]);
22+
startTransition(() => setToastList((prev) => [{ type: 'warning', text, id: getId() }, ...prev]));
2323
const setErrorToast = (text: string) =>
24-
setToastList((prev) => [{ type: 'error', text, id: getId() }, ...prev]);
24+
startTransition(() => setToastList((prev) => [{ type: 'error', text, id: getId() }, ...prev]));
2525

2626
useEffect(() => {
2727
const toastEvent = ToastEvent.getInstance();

0 commit comments

Comments
Β (0)