Skip to content

🐛 [BUG] - Renderer assumes Array.prototype.sort is stable #660

@edmorrish

Description

@edmorrish

Description

Using v3.0.0-beta15 on a few TVs we've seen an issue where the children sort in CoreNode (

this.children.sort((a, b) => a.calcZIndex - b.calcZIndex);
) re-arranges a list of children with equal z-index because it's using an unstable sort algorithm for lists longer than 10 items.

Pre-Chrome v70 sort is not expected to be stable: https://v8.dev/features/stable-sort

This results in a difference in the order of draw calls between devices with stable sort and those without.

Reproduction URL

n/a - not reproducible on modern browser

Reproduction steps

1. On an affected device create a Node with over 10 overlapping children without explicit Z-Indexes
2. Render it
3. Observe that they are renderered out-of-order

Screenshots

Logs

Browsers

Other, Chromium

Browser version

At least all Chrome pre-v70, probably others - Issue present on WebView on Android TV 10 & 11.

OS

Android

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions