瀏覽代碼

[xc-admin] frontend update permissions bugfix (#528)

* fix bug where setting new pubkey and reverting the change doesnt reflect properly

* fix bug where switching to cluster with permissionAccount and switching back doesnt show default value

* remove console.log
Daniel Chew 2 年之前
父節點
當前提交
fe3816f69a
共有 1 個文件被更改,包括 8 次插入0 次删除
  1. 8 0
      governance/xc-admin/packages/xc-admin-frontend/components/tabs/UpdatePermissions.tsx

+ 8 - 0
governance/xc-admin/packages/xc-admin-frontend/components/tabs/UpdatePermissions.tsx

@@ -139,6 +139,8 @@ const UpdatePermissions = () => {
           pubkey: securityAuthority,
         },
       ])
+    } else {
+      setData([...DEFAULT_DATA])
     }
   }, [rawConfig])
 
@@ -228,6 +230,12 @@ const UpdatePermissions = () => {
           new: newPubkey,
         },
       })
+    } else {
+      // delete account from pubkeyChanges if it exists
+      if (pubkeyChanges && pubkeyChanges[account]) {
+        delete pubkeyChanges[account]
+      }
+      setPubkeyChanges(pubkeyChanges)
     }
   }