Skip to content

Commit 10070d4

Browse files
jvgomgclaude
andcommitted
fix(ipod-web): resolve typecheck and lint errors
Use a fresh ArrayBuffer for ImageData construction to avoid SharedArrayBuffer type mismatch, and allow console in ipod-web and podkit-cli main entry point. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 6f4774c commit 10070d4

2 files changed

Lines changed: 19 additions & 10 deletions

File tree

oxlint.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,18 @@
6565
"rules": {
6666
"no-console": "off"
6767
}
68+
},
69+
{
70+
"files": ["**/ipod-web/src/**/*.ts", "**/ipod-web/src/**/*.tsx"],
71+
"rules": {
72+
"no-console": "off"
73+
}
74+
},
75+
{
76+
"files": ["**/podkit-cli/src/main.ts"],
77+
"rules": {
78+
"no-console": "off"
79+
}
6880
}
6981
],
7082
"ignorePatterns": ["node_modules", "dist", "*.d.ts", "backlog", "docs"]

packages/ipod-web/src/hooks/useTrackArtwork.ts

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,15 @@ import { databaseAtom } from '../store/database.js';
77
* Uses an OffscreenCanvas (or falls back to a regular canvas) to encode as PNG.
88
*/
99
function rgbaToObjectUrl(data: Uint8Array, width: number, height: number): Promise<string> {
10+
// Copy into a fresh ArrayBuffer (ImageData doesn't accept SharedArrayBuffer)
11+
const buf = new ArrayBuffer(data.byteLength);
12+
new Uint8Array(buf).set(data);
13+
const clamped = new Uint8ClampedArray(buf);
14+
1015
if (typeof OffscreenCanvas !== 'undefined') {
1116
const canvas = new OffscreenCanvas(width, height);
1217
const ctx = canvas.getContext('2d')!;
13-
const imageData = new ImageData(
14-
new Uint8ClampedArray(data.buffer, data.byteOffset, data.byteLength),
15-
width,
16-
height
17-
);
18+
const imageData = new ImageData(clamped, width, height);
1819
ctx.putImageData(imageData, 0, 0);
1920
return canvas.convertToBlob({ type: 'image/png' }).then((blob) => URL.createObjectURL(blob));
2021
}
@@ -24,11 +25,7 @@ function rgbaToObjectUrl(data: Uint8Array, width: number, height: number): Promi
2425
canvas.width = width;
2526
canvas.height = height;
2627
const ctx = canvas.getContext('2d')!;
27-
const imageData = new ImageData(
28-
new Uint8ClampedArray(data.buffer, data.byteOffset, data.byteLength),
29-
width,
30-
height
31-
);
28+
const imageData = new ImageData(clamped, width, height);
3229
ctx.putImageData(imageData, 0, 0);
3330
return new Promise((resolve) => {
3431
canvas.toBlob((blob) => {

0 commit comments

Comments
 (0)