Skip to content

Commit

Permalink
Move includes check outside of remove, see phetsims/axon#332
Browse files Browse the repository at this point in the history
  • Loading branch information
samreid committed Dec 6, 2020
1 parent 5cae5ef commit 60f5612
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion js/systems/model/EnergyConverter.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ class EnergyConverter extends EnergySystemElement {
* @public
*/
extractOutgoingEnergyChunks() {
this.energyChunkList.removeAll( this.outgoingEnergyChunks );
const energyChunksToRemove = this.outgoingEnergyChunks.filter( energyChunk => this.energyChunkList.includes( energyChunk ) );
this.energyChunkList.removeAll( energyChunksToRemove );

const outgoingEnergyChunksCopy = this.outgoingEnergyChunks.getArrayCopy();
this.outgoingEnergyChunks.clear();
Expand Down

0 comments on commit 60f5612

Please sign in to comment.