Skip to content

Bug fix: Overlay/Separate track order preserved#1970

Merged
jrobinso merged 2 commits intomasterfrom
dat-track-order-bug
May 2, 2025
Merged

Bug fix: Overlay/Separate track order preserved#1970
jrobinso merged 2 commits intomasterfrom
dat-track-order-bug

Conversation

@turner
Copy link
Contributor

@turner turner commented May 2, 2025

No description provided.

@jrobinso jrobinso requested a review from Copilot May 2, 2025 20:50
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR addresses a bug with preserving the overlay and separate track order by introducing asynchronous handling for track reordering.

  • Converted synchronous click handlers to async functions.
  • Added await calls for browser view updates and track reordering in both overlayTrackButton.js and mergedTrack.js.

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
js/ui/overlayTrackButton.js Made trackOverlayClickHandler async and awaited reorderTracks
js/feature/mergedTrack.js Made click handler async and awaited updateViews and reorderTracks

this.browser.addTrack(mergedTrack)
mergedTrack.trackView.updateViews()

await this.browser.reorderTracks()
Copy link

Copilot AI May 2, 2025

Choose a reason for hiding this comment

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

Consider adding error handling around the asynchronous call to 'reorderTracks' to manage any potential failures gracefully.

Suggested change
await this.browser.reorderTracks()
try {
await this.browser.reorderTracks()
} catch (error) {
console.error("Failed to reorder tracks:", error);
// Optionally, notify the user or take other recovery actions here
}

Copilot uses AI. Check for mistakes.
element.textContent = 'Separate tracks';

function click(e) {
async function click(e) {
Copy link

Copilot AI May 2, 2025

Choose a reason for hiding this comment

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

Using a plain async function here may cause 'this' to lose its intended binding when 'click' is invoked. Consider using an arrow function (e.g., 'click = async (e) => {') to preserve the lexical 'this' context.

Suggested change
async function click(e) {
const click = async (e) => {

Copilot uses AI. Check for mistakes.
@jrobinso jrobinso merged commit 7158f13 into master May 2, 2025
2 checks passed
@jrobinso jrobinso deleted the dat-track-order-bug branch May 2, 2025 21:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants