aicam commented on code in PR #8386:
URL: https://github.com/apache/texera/pull/8386#discussion_r3962032237
##########
frontend/src/app/dashboard/component/user/filters/filters.component.ts:
##########
@@ -113,14 +129,71 @@ export class FiltersComponent implements OnInit {
private cdr: ChangeDetectorRef
) {}
- /** The id dropdown is hidden for kinds with no id-listing endpoint. */
+ /**
+ * The id dropdown is hidden for kinds with no id-listing endpoint. A page
listing every kind keeps
+ * the workflow ids it had before: that page lists workflows too, and the
backend binds `id=` to
+ * the workflow arm, exactly as the operator facet is workflow-only.
+ */
public get hasIdFilter(): boolean {
- return this.resourceRegistry.get(this.entityType).retrieveIds !==
undefined;
+ return this.resourceRegistry.get(this.entityType ??
EntityType.Workflow).retrieveIds !== undefined;
}
ngOnInit(): void {
this.trackLoginState();
this.searchParameterBackendSetup();
+ this.facetReload$
+ .pipe(
+ // switchMap: without it a stale response can land last and refill the
facet.
+ switchMap(() =>
+ forkJoin({
+ owners: this.ownersForCurrentScope(),
+ ids: this.idsForCurrentKind(),
+ })
+ ),
+ untilDestroyed(this)
+ )
+ .subscribe(facets => this.applyFacets(facets));
+ // Through the subject, not a separate subscribe: an init response that
landed after a tab
+ // switch would otherwise overwrite the new kind's facets.
+ this.facetReload$.next();
+ }
+
+ ngOnChanges(changes: SimpleChanges): void {
+ const changed = changes["entityType"] ?? changes["ownerScope"];
+ // ngOnChanges runs before ngOnInit, so the first pass is left to
ngOnInit's single load.
+ if (changed && !changed.firstChange) {
+ this.reloadFacets();
+ }
+ }
+
+ /** Refetches both facets for the kind and scope now in effect. */
+ private reloadFacets(): void {
+ this.owners = [];
+ this.wids = [];
+ this.facetReload$.next();
Review Comment:
`reloadFacets` clears `owners`/`wids` but not
`selectedOwners`/`selectedIDs`, so a tab switch runs a search with the previous
tab's selection still applied.
`SearchComponent.filterByType()` calls `search()` synchronously, well before
the new facet response lands. With `owner: [email protected]` ticked on Workflows,
clicking Datasets sends a first request filtered by an owner that belongs to
the workflow facet — typically zero results. Only once `applyFacets` →
`updateDropdownMenus` runs does the chip get dropped and a corrected second
search fire. The user sees an empty tab flash: the same symptom this PR sets
out to remove, now transient.
Clearing the selections here alongside the lists would drop the bad first
request. Worth noting the sign-out branch in `trackLoginState` has the same gap
and clears its lists inline, so it needs the same treatment — otherwise the
anonymous hub stays filtered by an owner the facet no longer offers.
--
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]