imbajin commented on code in PR #882:
URL: 
https://github.com/apache/hugegraph-toolchain/pull/882#discussion_r4430533112


##########
hugegraph-hubble/hubble-fe/src/modules/component/ImportData/index.js:
##########
@@ -43,6 +43,39 @@ const ImportData = props => {
     } = props;
 
     const {graphSpace, graph} = useContext(GraphAnalysisContext);
+    const scope = useRef({graphSpace, graph});
+    const mounted = useRef(false);
+    scope.current = {graphSpace, graph};

Review Comment:
   [P2] Bind upload completion to the graph scope that started it
   
   The new check protects only the confirmation dialog. After confirming an 
import for graph A, the upload can remain in flight while the user changes to 
graph B. ImportData stays mounted across that change (only the inner Graph 
canvas is keyed by scope), and handleUploadChange still forwards A's eventual 
completion to the stable resetGraphStatus callback, which updates the current 
query result without a scope/generation check. A's returned data can therefore 
replace B's current canvas. This does not mean that the server writes were sent 
to B; the issue is applying A's response to B's UI.
   
   Please bind each upload/file request to its starting scope/generation and 
ignore subsequent events after that generation is invalidated, including 
failures and loading updates. Add a deferred-upload regression that starts A, 
switches to B before completion, and verifies B's result/status remain 
unchanged. Aborting a client request must not be described as rolling back a 
write already submitted to the server.
   
   Evidence: independent exact-version static parent-chain review and a bounded 
probe of the extracted callback; no React/browser/live Server execution. The 
response handler is pre-existing, but this PR makes the graph-writing upload 
endpoint reachable and introduces scope-safe confirmation.
   
   Sources: 
https://github.com/apache/hugegraph-toolchain/blob/18c5073344996da95aef016c2bab7716a34615e9/hugegraph-hubble/hubble-fe/src/modules/component/ImportData/index.js#L46-L108
 and 
https://github.com/apache/hugegraph-toolchain/blob/18c5073344996da95aef016c2bab7716a34615e9/hugegraph-hubble/hubble-fe/src/modules/analysis/Home/index.js#L699-L707
 .



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to