Skip to content

Conversation

PaulKokhanov1
Copy link
Contributor

@PaulKokhanov1 PaulKokhanov1 commented Apr 17, 2025

Description of change

update removeParticles logic to match description provided. Set the endIndex to default to the container length

Closes #11357

Pre-Merge Checklist
  • Tests and/or benchmarks are included
  • Documentation is changed or added
  • Lint process passed (npm run lint)
  • Tests passed (npm run test)

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your PR title doesn't match the required format. The title should be in this format:

chore: update Text docs
fix: text not rendering
feat: add new feature to Text
breaking: remove Text#resolution 

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your PR title doesn't match the required format. The title should be in this format:

chore: update Text docs
fix: text not rendering
feat: add new feature to Text
breaking: remove Text#resolution 

Copy link

codesandbox-ci bot commented Apr 17, 2025

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit 9d87daf:

Sandbox Source
pixi.js-sandbox Configuration

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your PR title doesn't match the required format. The title should be in this format:

chore: update Text docs
fix: text not rendering
feat: add new feature to Text
breaking: remove Text#resolution 

@PaulKokhanov1 PaulKokhanov1 changed the title fix default values on removeParticles logic fix: default values on removeParticles logic Apr 17, 2025
@PaulKokhanov1 PaulKokhanov1 marked this pull request as ready for review April 17, 2025 13:12
Comment on lines 305 to 310
// Default beginIndex to 0 if not provided
const start = beginIndex ?? 0;
// Default endIndex to the length of particleChildren if not provided
const end = endIndex ?? this.particleChildren.length;
// Remove the correct range
const children = this.particleChildren.splice(start, end);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alternatively:

Suggested change
// Default beginIndex to 0 if not provided
const start = beginIndex ?? 0;
// Default endIndex to the length of particleChildren if not provided
const end = endIndex ?? this.particleChildren.length;
// Remove the correct range
const children = this.particleChildren.splice(start, end);
// Default beginIndex to 0 if not provided
beginIndex ??= 0;
// Default endIndex to the length of particleChildren if not provided
endIndex ??= this.particleChildren.length;
// Remove the correct range
const children = this.particleChildren.splice(beginIndex, endIndex);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be considered a breaking change because users may have removeParticles() calls in production. If their pixijs version isn't locked, their next release could exhibit unintentional behavior if they upgrade without thorough testing.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tweaked this based on your feedback @bigtimebuddy .
Thanks for youre insight @susiwen8! , whilst it is kind of a breaking change, it also is fixing incorrect behaviour. With that in mind, I think on this occasion its ok not to consider this breaking as the use case would be quite strange!

@Zyie Zyie added the ✅ Ready To Merge Helpful when issues are in the queue waiting to get merged. This means the PR is completed and has t label May 9, 2025
@Zyie Zyie added this pull request to the merge queue May 9, 2025
Merged via the queue into dev with commit 7b986e1 May 9, 2025
5 checks passed
@Zyie Zyie deleted the fix_default_values_on_removeParticles_logic branch May 9, 2025 10:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
✅ Ready To Merge Helpful when issues are in the queue waiting to get merged. This means the PR is completed and has t
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bug: The "removeParticles" function has wrong default values.
5 participants