Yicong-Huang commented on code in PR #6116:
URL: https://github.com/apache/texera/pull/6116#discussion_r3524194861
##########
frontend/src/app/dashboard/service/admin/settings/admin-settings.service.ts:
##########
@@ -31,9 +31,29 @@ import { map } from "rxjs/operators";
providedIn: "root",
})
export class AdminSettingsService {
- private readonly BASE_URL = "/api/admin/settings";
+ private readonly BASE_URL = "/api/config/settings";
+
+ // One request for all user-visible settings, shared by every consumer.
+ // The admin settings page reloads the whole window after saving, so a
+ // per-page-load cache never serves stale values.
+ private publicSettings$?: Observable<Record<string, string>>;
+
constructor(private http: HttpClient) {}
+ /**
+ * Reads one of the user-visible settings (branding, sidebar tabs, upload
+ * limits) through the aggregated REGULAR-accessible endpoint.
+ */
+ getPublicSetting(key: string): Observable<string> {
+ if (!this.publicSettings$) {
+ this.publicSettings$ = this.http.get<Record<string,
string>>(`${this.BASE_URL}/public`).pipe(shareReplay(1));
+ }
+ return this.publicSettings$.pipe(map(settings => settings[key] ?? null));
Review Comment:
Good catch — fixed in 0cac2adde: `catchError` now drops the cached
observable and rethrows before `shareReplay`, so an errored fetch is never
replayed and the next `getPublicSetting` call retries the request. Consumers
keep their defaults on error, same as before.
--
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]