tanishqgandhi1908 commented on code in PR #8386:
URL: https://github.com/apache/texera/pull/8386#discussion_r3962879036
##########
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:
Good catch — fixed in a73b6f4eb.
One correction: clearing inside reloadFacets would still be too late.
filterByType calls search() in the same turn as the click, and that reads the
filter params before ngOnChanges runs. So filterByType now clears first, via a
new clearFacetSelections() that drops the owner:/id: tags too. Sign-out goes
through the same path — you were right that it never revalidated.
Two behaviour changes: a selection is dropped even when the new kind offers
the same owner (the bar can't know it's valid until the facet lands, and the
host has already searched by then), and switching tabs no longer raises
"Invalid owner name".
--
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]