Repository navigation
repair(perf): preserve GrooveMap delta while removing stale branch drift #859
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 12 commits
060501f
aecfb52
7c9b2a6
e0bd382
4114032
b04e6a6
e55c072
9e43f62
18d3c1d
a908920
715c4da
d311e01
9751805
ace2744
294d995
6486618
38e1027
d7e1369
888c925
055db2b
a45b2d1
a649e18
c9c4ad6
4107fa4
af87411
99e6a7d
7f5bf1c
5236ac2
ee0f383
abea1c4
9e58b22
0de77e2
370bd5d
62fd665
7c6c52f
e0b1617
ba07701
fa1ced9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| import { render, screen } from "@testing-library/react"; | ||
| import { describe, expect, it } from "vitest"; | ||
| import { GrooveMap } from "./GrooveMap"; | ||
|
|
||
| describe("GrooveMap", () => { | ||
| it("uses the latest note offset as the timeline maximum when it exceeds the ten-second floor", () => { | ||
| render( | ||
| <GrooveMap | ||
| notes={[ | ||
| { pitch: "E2", onset: 10, offset: 20, velocity: 0.8 }, | ||
| { pitch: "G2", onset: 2, offset: 12, velocity: 0.7 } | ||
| ]} | ||
| /> | ||
| ); | ||
|
|
||
| const latestNote = screen.getByTitle("E2 (10.00s - 20.00s)"); | ||
| const earlierNote = screen.getByTitle("G2 (2.00s - 12.00s)"); | ||
|
|
||
| expect(latestNote.style.left).toBe("50%"); | ||
| expect(latestNote.style.width).toBe("50%"); | ||
| expect(earlierNote.style.left).toBe("10%"); | ||
| expect(earlierNote.style.width).toBe("50%"); | ||
| }); | ||
|
|
||
| it("retains the ten-second timeline floor when every note ends earlier", () => { | ||
| render( | ||
| <GrooveMap notes={[{ pitch: "A2", onset: 2, offset: 5, velocity: 0.6 }]} /> | ||
| ); | ||
|
|
||
| const note = screen.getByTitle("A2 (2.00s - 5.00s)"); | ||
|
|
||
| expect(note.style.left).toBe("20%"); | ||
| expect(note.style.width).toBe("30%"); | ||
| }); | ||
| }); |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -17,7 +17,11 @@ function GrooveMapComponent({ notes, isLoading }: GrooveMapProps) { | |
|
|
||
| // Find max offset to determine timeline width | ||
| const maxTime = useMemo(() => { | ||
| return renderedNotes.reduce((max, n) => Math.max(max, n.offset), 10); | ||
| let max = 10; | ||
| for (const n of renderedNotes) { | ||
| if (n.offset > max) max = n.offset; | ||
| } | ||
| return max; | ||
|
devin-ai-integration[bot] marked this conversation as resolved.
Comment on lines
+20
to
+24
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 📝 Info: GrooveMap maxTime no longer propagates NaN The new loop uses Was this helpful? React with 👍 or 👎 to provide feedback. |
||
| }, [renderedNotes]); | ||
|
devin-ai-integration[bot] marked this conversation as resolved.
Comment on lines
19
to
25
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 📝 Info: GrooveMap max loop silently changes NaN handling The old Was this helpful? React with 👍 or 👎 to provide feedback. |
||
|
|
||
| // Unique pitches to determine vertical lanes (avoiding 88-key piano roll) | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.