pomelo-io / bounties-issues-dev

Dev repo for bounties
0 stars 0 forks source link

💰 0 USDT Bounty - "bug(MatButton): MatButton leaking memory when re.." #133

Closed PomeloBounties closed 7 months ago

PomeloBounties commented 7 months ago

Bounty

bug(MatButton): MatButton leaking memory when removed from DOM with ngIf created by @SoA432 on Pomelo Bounties

Summary

Hire a developer to solve the bug(MatButton): MatButton leaking memory when removed from DOM with ngIf. Must be able to reproduce the issue, understand the cause and come up with a fix. The developer should have experience working with Angular, CDK/Material, and have knowledge of memory management.

Apply

https://bounties.pomelo.io/aa3c1ed4beba

Original Issue

https://github.com/angular/components/issues/28241

Title

bug(MatButton): MatButton leaking memory when removed from DOM with ngIf

Body

Is this a regression?

The previous version in which this bug was not present was

14.2.7

Description

Garbage collection does not happen when buttons are deleted from DOM using ngIf. The issue does not occur with MatLegacyButtonModule only with the MatButtonModule.

Other components seem to work fine using the same testing methodology.

Reproduction

Steps to reproduce:

  1. Create a new Angular app
  2. Use two material buttons in a component. The two buttons switch each other out using a bool variable and ngIf.
  3. Press the available button multiple times.
  4. Inspect memory usage.

Example code:

import { CommonModule } from '@angular/common';
import { Component } from '@angular/core';
import { MatButtonModule } from '@angular/material/button';

@Component({
  selector: 'app-demo',
  templateUrl: './demo.component.html',
  styleUrls: ['./demo.component.scss'],
  standalone: true,
  imports: [MatButtonModule, CommonModule],
})
export class DemoComponent {
  public shown = false;
}
<button mat-button *ngIf="shown" (click)="shown = false">Demo shown</button>
<button mat-button *ngIf="!shown" (click)="shown = true">Demo not shown</button>

Expected Behavior

Buttons are garbage collected.

Actual Behavior

Buttons are not garbage collected. At startup: image After multiple clicks: image

Environment

Base Reward

0.0500 USDT

Note

For technical discussion use the original issue. This issue is for tracking the bounty application and implementation progress.

PomeloBounties commented 7 months ago

Bounty fully funded with 0.0500 USDT reward!

Accepting applications here

PomeloBounties commented 7 months ago

Bounty application submitted by @yevheniiaKhmara with a message:

fasfas

Waiting for your approval @SoA432

PomeloBounties commented 7 months ago

Bounty application submitted by @yevheniiaKhmara with a message:

reapplly

Waiting for your approval @SoA432

PomeloBounties commented 7 months ago

Bounty application denied for @yevheniiaKhmara with a message:

N/A

PomeloBounties commented 7 months ago

Bounty closed by the funder