-
Notifications
You must be signed in to change notification settings - Fork 387
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature/cxspa 4110 quote cart #17687
Feature/cxspa 4110 quote cart #17687
Conversation
|
: list; | ||
if (order) { | ||
//deep copy order list | ||
const clonedActionList = order.map((actionType) => actionType); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'minor': consider using the new global method structuredClone
that has been introduced for deep copying.
For more, see: https://developer.mozilla.org/en-US/docs/Web/API/structuredClone
@Component({ | ||
templateUrl: './quote-aware.component.html', | ||
}) | ||
export class QuoteAwareComponent {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
query:
Can you remind me what was the idea behind this component and related logic?
@Injectable({ | ||
providedIn: 'root', | ||
}) | ||
export class QuoteCartService { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
minor
: I propose creating a ticket about removing this service once the backend is ready and adding comments with the ticket number to all related places. It may be useful in terms of tracking and refactoring.
}) | ||
export class QuoteCartService { | ||
private quoteId: Observable<string> = new ReplaySubject<string>(1); | ||
private quoteCartActive: Observable<boolean> = new ReplaySubject<boolean>(1); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
minor
: Instead of casting this field each time you want to use ReplaySubject
methods, I propose reversed approach - keep the ReplaySubject
type and update the stream each time you need, but when you want some method returns an observable that can't be modified, use asObservable
:
private quoteCartActive = new ReplaySubject<boolean>(1);
[...]
public setQuoteId(quoteId: string): void {
this.quoteId.next(quoteId);
}
public getQuoteId(): Observable<string> {
return this.quoteId.asObservable();
}
Instead I have merged #17721 which is based on this one |
No description provided.