This is an automated email from the ASF dual-hosted git repository.
github-merge-queue[bot] pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/texera.git
The following commit(s) were added to refs/heads/main by this push:
new 00395b8559 fix(frontend): clear the picked version when switching
datasets in the dataset picker (#8928)
00395b8559 is described below
commit 00395b8559e1b8f061e1da80eed4427b0da9a56a
Author: Tanishq Gandhi <[email protected]>
AuthorDate: Mon Oct 26 02:43:01 2026 +0000
fix(frontend): clear the picked version when switching datasets in the
dataset picker (#8928)
### What changes were proposed in this PR?
DatasetSelectionModalComponent.onDatasetChange cleared the file tree but
kept the previously picked version and path. After switching datasets,
the version box still showed the old version name, Select stayed
enabled, and clicking it returned the previous dataset’s path.
It now clears selectedVersion and selectedPath when the dataset changes,
as ModelSelectionModalComponent.onModelChange already does. In file mode
this also drops the previous file when the new dataset has no versions
or its versions are still loading.
Reopening the picker on a saved value now also re-selects that version
in non-file mode; previously only file mode did, so File Lister showed
an empty version box.
Before: after switching to weather-readings, “v1” is still shown and
Select returns owner-access-demo’s path:
<img width="1440" height="900" alt="before-2-switched-to-b"
src="https://github.com/user-attachments/assets/fb5d1fbc-6fd7-4385-93cd-555e861988f5"
/>
<img width="1440" height="900" alt="before-3-field-value"
src="https://github.com/user-attachments/assets/d621cb88-9512-4975-9ba1-1cfd6f6239cc"
/>
After: the version box is emptied and Select is disabled until a version
of the new dataset is picked, which then gives the right path:
<img width="1440" height="900" alt="after-1-switched-to-b"
src="https://github.com/user-attachments/assets/4f696e69-be45-4eaa-9a02-dbf1c9894086"
/>
<img width="1440" height="900" alt="after-2-field-value"
src="https://github.com/user-attachments/assets/aa95879d-c72f-4978-a9a5-5700642be4f8"
/>
Reopening the picker shows the saved dataset and version:
<img width="1440" height="900" alt="after-3-reopened"
src="https://github.com/user-attachments/assets/26d07a7f-8c5f-4ba4-983e-70624574cb41"
/>
### Any related issues, documentation, discussions?
Closes #8927
### How was this PR tested?
Added three cases to dataset-selection-modal.component.spec.ts:
Switching datasets disables Select again (non-file mode).
Switching to a dataset with no versions drops the previous file (file
mode).
Reopening on a saved value re-selects that version (non-file mode).
The first two fail without the fix.
cd frontend
yarn ng test --watch=false
--include='**/dataset-selection-modal.component.spec.ts'
Tests 19 passed (19)
Also checked against a local stack with a File Lister operator,
following the steps in #8927, and by reopening the picker afterwards.
### Was this PR authored or co-authored using generative AI tooling?
Generated-by: Claude Code (Claude Opus 5.5)
Co-authored-by: Xuan Gu <[email protected]>
---
.../dataset-selection-modal.component.spec.ts | 45 ++++++++++++++++++++++
.../dataset-selection-modal.component.ts | 7 +++-
2 files changed, 50 insertions(+), 2 deletions(-)
diff --git
a/frontend/src/app/workspace/component/dataset-selection-modal/dataset-selection-modal.component.spec.ts
b/frontend/src/app/workspace/component/dataset-selection-modal/dataset-selection-modal.component.spec.ts
index f42ae00a81..67da1511b8 100644
---
a/frontend/src/app/workspace/component/dataset-selection-modal/dataset-selection-modal.component.spec.ts
+++
b/frontend/src/app/workspace/component/dataset-selection-modal/dataset-selection-modal.component.spec.ts
@@ -295,6 +295,51 @@ describe("DatasetSelectionModalComponent", () => {
expect(confirmButton().disabled).toBe(false);
});
+ it("disables Select again when another dataset is picked", () => {
+ datasetService.retrieveAccessibleDatasets.mockReturnValue(of([dataset,
sharedDataset]));
+ build();
+ selects()[0].triggerEventHandler("ngModelChange", dataset);
+ selects()[1].triggerEventHandler("ngModelChange", version);
+ fixture.detectChanges();
+ expect(confirmButton().disabled).toBe(false);
+
+
datasetService.retrieveDatasetVersionList.mockReturnValue(of([sharedVersion]));
+ selects()[0].triggerEventHandler("ngModelChange", sharedDataset);
+ fixture.detectChanges();
+
+ expect(component.selectedVersion).toBeUndefined();
+ expect(confirmButton().disabled).toBe(true);
+ });
+
+ it("drops the previous file when switching to a dataset with no versions
in file mode", () => {
+ datasetService.retrieveAccessibleDatasets.mockReturnValue(of([dataset,
sharedDataset]));
+ modalData.fileMode = true;
+ modalData.selectedPath = `/dataset/${OWNER}/myds/v1`;
+ build();
+ fixture.debugElement
+ .query(By.directive(UserDatasetVersionFiletreeComponent))
+ .triggerEventHandler("selectedTreeNode", fileNode);
+ fixture.detectChanges();
+ expect(confirmButton().disabled).toBe(false);
+
+ datasetService.retrieveDatasetVersionList.mockReturnValue(of([]));
+ selects()[0].triggerEventHandler("ngModelChange", sharedDataset);
+ fixture.detectChanges();
+
+ expect(component.selectedPath).toBeUndefined();
+ expect(confirmButton().disabled).toBe(true);
+ });
+
+ it("reselects the saved version when reopened in non-file mode", () => {
+ modalData.selectedPath = `/dataset/${OWNER}/myds/v1`;
+ build();
+
+ expect(component.selectedVersion).toBe(version);
+ expect(confirmButton().disabled).toBe(false);
+ confirmButton().click();
+ expect(modalRef.close).toHaveBeenCalledWith(`/dataset/${OWNER}/myds/v1`);
+ });
+
it("closes the modal with the composed path when Select is clicked", () =>
{
build();
selects()[0].triggerEventHandler("ngModelChange", dataset);
diff --git
a/frontend/src/app/workspace/component/dataset-selection-modal/dataset-selection-modal.component.ts
b/frontend/src/app/workspace/component/dataset-selection-modal/dataset-selection-modal.component.ts
index b5768aa685..8d5d517a8a 100644
---
a/frontend/src/app/workspace/component/dataset-selection-modal/dataset-selection-modal.component.ts
+++
b/frontend/src/app/workspace/component/dataset-selection-modal/dataset-selection-modal.component.ts
@@ -100,14 +100,17 @@ export class DatasetSelectionModalComponent implements
OnInit {
onDatasetChange(versionName?: string) {
this.fileTree = [];
+ this.selectedVersion = undefined;
+ this.selectedPath = undefined;
if (this.selectedDataset?.dataset.did !== undefined) {
this.datasetService
.retrieveDatasetVersionList(this.selectedDataset.dataset.did)
.pipe(untilDestroyed(this))
.subscribe(versions => {
this.datasetVersions = versions;
- if (this.data.fileMode) {
- this.selectedVersion = versions.find(version => version.name ===
versionName) ?? versions[0];
+ const savedVersion = versions.find(version => version.name ===
versionName);
+ this.selectedVersion = this.data.fileMode ? savedVersion ??
versions[0] : savedVersion;
+ if (this.selectedVersion) {
this.onVersionChange();
}
});