Skip to content

Commit

Permalink
fix build errors
Browse files Browse the repository at this point in the history
  • Loading branch information
brollin committed Nov 5, 2024
1 parent 8e1d605 commit 0387a39
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/app/api/upload/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export const POST = async (req: Request, res: Response) => {
process.cwd(),
`public/${LOCAL_ASSET_DIRECTORY}${AUDIO_ASSET_PREFIX}${filename}`
),
buffer
new Uint8Array(buffer)
);
return NextResponse.json({ Message: "Success", status: 201 });
} catch (error) {
Expand Down
6 changes: 4 additions & 2 deletions src/components/UploadAudioModalContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {
} from "@chakra-ui/react";
import { useStore } from "@/src/types/StoreContext";
import { useRef, useState } from "react";
import { action } from "mobx";
import { action, runInAction } from "mobx";
import {
uploadAudioFileToS3,
uploadAudioFileToServer,
Expand Down Expand Up @@ -59,7 +59,9 @@ const UploadAudioModalContent = observer(function UploadAudioModalContent() {
await utils.song.listSongs.invalidate();
setUploading(false);

audioStore.selectedSong = newSong;
runInAction(() => {
audioStore.selectedSong = newSong;
});
onClose();
});

Expand Down
2 changes: 1 addition & 1 deletion src/scripts/assetManagement.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export const downloadAudio = async (s3: S3Client) => {
if (audioData?.length)
fs.writeFileSync(
`${LOCAL_ASSET_PATH}${AUDIO_ASSET_PREFIX}${filename}`,
Buffer.from(audioData)
new Uint8Array(Buffer.from(audioData))
);
}
};
2 changes: 1 addition & 1 deletion src/scripts/generateCanopy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const saveBinary = (filename: string, data: CanopyGeometry) => {
...data.normal,
]);
const buffer = Buffer.from(float32Array.buffer);
fs.writeFileSync(filename, buffer);
fs.writeFileSync(filename, new Uint8Array(buffer));
};

const main = async () => {
Expand Down

0 comments on commit 0387a39

Please sign in to comment.