Pārlūkot izejas kodu

fix: do not reactive when changed profile is not current

dongchengjie 11 mēneši atpakaļ
vecāks
revīzija
c1a201f358
1 mainītis faili ar 6 papildinājumiem un 2 dzēšanām
  1. 6 2
      src/pages/profiles.tsx

+ 6 - 2
src/pages/profiles.tsx

@@ -429,7 +429,9 @@ const ProfilePage = () => {
                       onSelect={(f) => onSelect(item.uid, f)}
                       onEdit={() => viewerRef.current?.edit(item)}
                       onChange={async (prev, curr) => {
-                        prev !== curr && (await onEnhance());
+                        if (prev !== curr && profiles.current === item.uid) {
+                          await onEnhance();
+                        }
                       }}
                       onDelete={() => onDelete(item.uid)}
                     />
@@ -466,7 +468,9 @@ const ProfilePage = () => {
                     onMoveEnd={() => onMoveEnd(item.uid)}
                     onEdit={() => viewerRef.current?.edit(item)}
                     onChange={async (prev, curr) => {
-                      prev !== curr && (await onEnhance());
+                      if (prev !== curr && chain.includes(item.uid)) {
+                        await onEnhance();
+                      }
                     }}
                   />
                 </Grid>