rbelavadi commented on code in PR #7043:
URL: https://github.com/apache/texera/pull/7043#discussion_r3685856090
##########
frontend/src/app/dashboard/component/user/user-dataset/user-dataset-explorer/dataset-detail.component.ts:
##########
@@ -421,6 +429,35 @@ export class DatasetDetailComponent implements OnInit {
}
}
+ // Fetches the latest version independently of the current selection and
derives
+ // the Data Card's latest-version facts from that single response: the file
name
+ // and created date directly, and the total size via a follow-up file-tree
fetch
+ // for the latest version's dvid (mirroring onVersionSelected's size lookup).
+ retrieveLatestVersionFile() {
+ if (this.did) {
+ const did = this.did;
+ this.datasetService
+ .retrieveDatasetLatestVersion(did)
+ .pipe(untilDestroyed(this))
+ .subscribe(version => {
+ const firstFile = this.getFirstFileNode(version.fileNodes ?? []);
+ this.latestVersionFileName = firstFile ?
getFullPathFromDatasetFileNode(firstFile) : "";
+ this.latestVersionCreationTime =
+ typeof version.creationTime === "number"
+ ? format(new Date(version.creationTime), "MM/dd/yyyy HH:mm:ss")
+ : "";
+ if (version.dvid) {
+ this.datasetService
+ .retrieveDatasetVersionFileTree(did, version.dvid, this.isLogin)
+ .pipe(untilDestroyed(this))
+ .subscribe(data => {
+ this.latestVersionSize = data.size;
+ });
+ }
Review Comment:
Fixed, switched to a stored-subscription pattern (matching the existing
uploadSubscriptions precedent in this file): each call to
retrieveLatestVersionFile() now cancels any previous in-flight request for both
the version fetch and the size fetch before starting a new one, so a stale
response can no longer overwrite fresher data. Also reset latestVersionSize to
undefined when the latest version has no dvid, matching this component's
existing convention for "no data" (same as
currentDatasetVersionSize/currentFileSize). Added a test that deterministically
proves an out-of-order response can't win.
--
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]