Skip to content

Commit

Permalink
Update add-products-shopping-list.component.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
Srijan25 authored Oct 14, 2024
1 parent 24110d0 commit 7150530
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,12 @@ export class AddProductsShoppingListComponent implements OnInit, AfterContentIni
showMoreButton = {
disabled: signal(false),
render: signal(false),
click: null
click: () => {
// The click function can check if it's disabled or not before proceeding.
if (!this.showMoreButton.disabled()) {
this.showMore();
}
}
};

toggleProductsView = signal(false);
Expand Down Expand Up @@ -212,7 +217,7 @@ export class AddProductsShoppingListComponent implements OnInit, AfterContentIni
}));

if (isFirstRender) {
this.showMoreButton.click = showMore;
this.showMore = showMore;

// When "isFirstRender" is true, we should return early to avoid unnecessary re-renders.
return;
Expand Down

0 comments on commit 7150530

Please sign in to comment.