Skip to content

Commit

Permalink
perf: switch to lazy triggering of 'loadProductParts' action
Browse files Browse the repository at this point in the history
* performance optimization to avoid unnecessary triggering of `loadProductParts` action for all products even if no parts are needed to be rendered
* the actual REST request was filtered in the effect to be only done for retail sets or bundles but the action was triggered all the time
  • Loading branch information
dhhyi authored and shauke committed May 16, 2024
1 parent 2732de4 commit e5f94f6
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/app/core/facades/product-context.facade.ts
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,8 @@ export class ProductContextFacade extends RxState<ProductContext> implements OnD
skipWhile(children => !children || !Object.values(children)?.length),
map(() => true)
),
this.select('parts').pipe(
this.select().pipe(
map(context => context.parts),
skipWhile(parts => !parts?.length),
map(() => true)
),
Expand Down

0 comments on commit e5f94f6

Please sign in to comment.