fix: DataSourceResolverService.resolve() had no catchError
A category/product facade error propagated through switchMap
uncaught, erroring the shared widget stream (shareReplay) in
WidgetHostService with no fallback - the widget just silently failed
to render, and the error stayed cached for every later subscriber.
Added catchError falling back to an empty { section, settings } shape,
same pattern as the widget-manifest fetch (falls back to { widgets: [] }
on any error, never throws to the UI).
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
import { Injectable, inject } from '@angular/core';
|
import { Injectable, inject } from '@angular/core';
|
||||||
import { Observable, of, map, switchMap } from 'rxjs';
|
import { Observable, of, map, switchMap, catchError } from 'rxjs';
|
||||||
import { CategoryFacade } from '../../facades/platform/category.facade';
|
import { CategoryFacade } from '../../facades/platform/category.facade';
|
||||||
import { ProductFacade } from '../../facades/platform/product.facade';
|
import { ProductFacade } from '../../facades/platform/product.facade';
|
||||||
import { LanguageService } from '../../services/language.service';
|
import { LanguageService } from '../../services/language.service';
|
||||||
@@ -19,7 +19,11 @@ export class DataSourceResolverService {
|
|||||||
|
|
||||||
resolve(widget: WidgetConfig, section: SectionConfig): Observable<unknown> {
|
resolve(widget: WidgetConfig, section: SectionConfig): Observable<unknown> {
|
||||||
return this.widgetManifest.getWidget(widget.type).pipe(
|
return this.widgetManifest.getWidget(widget.type).pipe(
|
||||||
switchMap((definition) => this.resolveByDefinition(definition, widget, section))
|
switchMap((definition) => this.resolveByDefinition(definition, widget, section)),
|
||||||
|
catchError((error) => {
|
||||||
|
console.error(`Failed to resolve widget data for ${widget.type}:${widget.id}`, error);
|
||||||
|
return of({ section, settings: {} });
|
||||||
|
})
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user