Przeglądaj źródła

fix: remove user.id dependency from local expiration state update

- Updated the useEffect hook in UserKeyTableRow to eliminate the user.id dependency, ensuring that local expiration state correctly reverts to user.expiresAt when optimisticExpiresAt is undefined. This change enhances the component's reliability in managing expiration states.
NightYu 1 miesiąc temu
rodzic
commit
fb2d95fd6d

+ 1 - 1
src/app/[locale]/dashboard/_components/user/user-key-table-row.tsx

@@ -120,7 +120,7 @@ export function UserKeyTableRow({
   // 修复:当 optimisticExpiresAt 变为 undefined 时也能正确回滚到 user.expiresAt
   useEffect(() => {
     setLocalExpiresAt(optimisticExpiresAt ?? user.expiresAt);
-  }, [optimisticExpiresAt, user.expiresAt, user.id]);
+  }, [optimisticExpiresAt, user.expiresAt]);
 
   const keyRowTranslations = {
     ...(translations.keyRow ?? {}),