You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@age.apache.org by hb...@apache.org on 2023/01/03 00:19:15 UTC

[age-viewer] branch main updated: fixed retrieving data bug after changing the graph (#92)

This is an automated email from the ASF dual-hosted git repository.

hbshin pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/age-viewer.git


The following commit(s) were added to refs/heads/main by this push:
     new 1393494  fixed retrieving data bug after changing the graph (#92)
1393494 is described below

commit 1393494b3d208905173ccba573f26373bd552ac0
Author: MJinH <97...@users.noreply.github.com>
AuthorDate: Mon Jan 2 16:19:11 2023 -0800

    fixed retrieving data bug after changing the graph (#92)
    
    Co-authored-by: moon19960501@gmail.com <we...@gmail.com>
---
 backend/src/services/databaseService.js                       | 6 +++---
 frontend/src/components/sidebar/presentations/SidebarHome.jsx | 6 +++++-
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/backend/src/services/databaseService.js b/backend/src/services/databaseService.js
index 482f4ea..2b75882 100644
--- a/backend/src/services/databaseService.js
+++ b/backend/src/services/databaseService.js
@@ -34,8 +34,8 @@ class DatabaseService {
         const { graphs } = gr.getConnectionInfo();
         await DatabaseService.analyzeGraph(gr);
         if (graphName) {
-            if (graphs.includes(graphName)) {
-                return await this.getMetaDataSingle(graphName, graphs);
+            if (graphs.includes(graphName.currentGraph)) {
+                return await this.getMetaDataSingle(graphName.currentGraph, graphs);
             } else {
                 return await this.getMetaDataSingle(gr._graph, graphs);
             }
@@ -67,9 +67,9 @@ class DatabaseService {
             data.graph = curGraph;
             data.database = database;
             data.role = await this.getRole();
-            metadata[curGraph] = data;
             graphs.forEach((gname) => {
                 if (gname !== curGraph) metadata[gname] = {};
+                else metadata[gname] = data;
             })
         } catch (error) {
             throw error;
diff --git a/frontend/src/components/sidebar/presentations/SidebarHome.jsx b/frontend/src/components/sidebar/presentations/SidebarHome.jsx
index d080cba..a9d75d3 100644
--- a/frontend/src/components/sidebar/presentations/SidebarHome.jsx
+++ b/frontend/src/components/sidebar/presentations/SidebarHome.jsx
@@ -17,7 +17,7 @@
  * under the License.
  */
 
-import React from 'react';
+import React, { useEffect } from 'react';
 import PropTypes from 'prop-types';
 
 import { Modal } from 'antd';
@@ -368,6 +368,10 @@ const SidebarHome = ({
   const dispatch = useDispatch();
   const { confirm } = Modal;
 
+  useEffect(() => {
+    dispatch(() => getMetaData({ currentGraph }));
+  }, [currentGraph]);
+
   const requestDisconnect = () => {
     const refKey = uuid();
     dispatch(() => trimFrame('ServerDisconnect'));