You've already forked matrix-react-sdk
mirror of
https://github.com/matrix-org/matrix-react-sdk.git
synced 2025-11-10 09:22:25 +03:00
Don't recurse on arrayFastResample
Fixes https://github.com/vector-im/element-web/issues/17136
This commit is contained in:
@@ -36,14 +36,12 @@ export function arrayFastResample(input: number[], points: number): number[] {
|
||||
}
|
||||
} else {
|
||||
// Smaller inputs mean we have to spread the values over the desired length. We
|
||||
// end up overshooting the target length in doing this, so we'll resample down
|
||||
// before returning. This recursion is risky, but mathematically should not go
|
||||
// further than 1 level deep.
|
||||
// end up overshooting the target length in doing this, but we're not looking to
|
||||
// be super accurate so we'll let the sanity trims do their job.
|
||||
const spreadFactor = Math.ceil(points / input.length);
|
||||
for (const val of input) {
|
||||
samples.push(...arraySeed(val, spreadFactor));
|
||||
}
|
||||
samples = arrayFastResample(samples, points);
|
||||
}
|
||||
|
||||
// Sanity fill, just in case
|
||||
|
||||
Reference in New Issue
Block a user