fix: review findings from full-diff audit (7 fixed)
Some checks failed
Architecture Governance / architecture (push) Has been cancelled
Some checks failed
Architecture Governance / architecture (push) Has been cancelled
- popularSearches sent translated display text as the actual search query instead of the canonical term - useSuggestion() now prefers target.query.q when present. - CartService.addItem() dedup guard resolved immediately instead of awaiting the real in-flight add; now tracks the pending Promise per itemID so concurrent callers await the actual result. - addItem()'s Promise never rejected on failure (resolve() in both next/error branches) - now rejects on error; buyNow() catches and shows an error toast instead of navigating on a failed add. - Quick View had no stale-response guard - a slower earlier request could overwrite a faster later one. Added a request-generation counter. - cart autoSubmitPurchase() set paymentStatus to null synchronously right after firing the async submit call, blanking the success screen while the request was still in flight. Removed the redundant/harmful line. - Order terminal-status guard (cancelled/refunded can't be reopened) lived only in the page component. Moved enforcement into the gateway (single write path) via a shared TERMINAL_ORDER_STATUSES const, so no future caller can bypass it. - TranslatePipe's per-instance memoization cache had no eviction, so bindings with volatile params (pagination counts) grew it unbounded for the component's lifetime. Capped at 50 entries. Not changed: the dark-mode color override was flagged as clobbering admin branding, but it's the exact palette explicitly requested this session for the global dark default - not a bug. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -11,6 +11,9 @@ import { LanguageService } from '../services/language.service';
|
||||
* nothing actually changed - hit a Map lookup instead of re-walking the
|
||||
* translation tree and re-running the interpolation regex.
|
||||
*/
|
||||
/** Bindings with volatile params (pagination counts, etc.) would otherwise grow this cache for the component's whole lifetime. */
|
||||
const MAX_CACHE_ENTRIES = 50;
|
||||
|
||||
@Pipe({
|
||||
name: 'translate',
|
||||
pure: false,
|
||||
@@ -36,6 +39,9 @@ export class TranslatePipe implements PipeTransform {
|
||||
}
|
||||
|
||||
const result = this.translateService.t(key, params);
|
||||
if (this.cache.size >= MAX_CACHE_ENTRIES) {
|
||||
this.cache.clear();
|
||||
}
|
||||
this.cache.set(cacheKey, result);
|
||||
return result;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user