Skip to content

Commit ac7e288

Browse files
committed
fix(studio): freeze-frame, loudness and peak-map requests go through studioApiFetch too
1 parent f98ab79 commit ac7e288

3 files changed

Lines changed: 7 additions & 4 deletions

File tree

‎packages/studio/src/hooks/useFreezeFrame.ts‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import { buildProjectApiPath } from "../utils/projectRouting";
66
import { markStudioWriteToken } from "../utils/studioFileVersion";
77
import { serializeStudioFileMutations } from "../utils/studioFileMutationCoordinator";
88
import type { RecordEditInput } from "../utils/studioFileHistory";
9+
import { studioApiFetch } from "../utils/studioApiFetch";
910

1011
type ProjectFileWriter = (path: string, content: string, expectedContent?: string) => Promise<void>;
1112

@@ -31,7 +32,7 @@ function errorOf(value: unknown): string | null {
3132
}
3233

3334
async function readVersion(projectId: string, path: string): Promise<string> {
34-
const response = await fetch(
35+
const response = await studioApiFetch(
3536
buildProjectApiPath(projectId, `/files/${encodeURIComponent(path)}`),
3637
);
3738
const body: unknown = await response.json().catch(() => null);
@@ -53,7 +54,7 @@ export async function requestFreezeFrame(input: {
5354
const expectedVersion = await readVersion(input.projectId, input.path);
5455
const transactionToken = `freeze:${crypto.randomUUID()}`;
5556
markStudioWriteToken(transactionToken);
56-
const response = await fetch(
57+
const response = await studioApiFetch(
5758
buildProjectApiPath(input.projectId, "/file-mutations/freeze-frame"),
5859
{
5960
method: "POST",

‎packages/studio/src/player/components/ClipPeakMarks.tsx‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
import { useEffect, useState, type ReactNode } from "react";
22
import { clipPeakRuns, isPeakMap, type ClipSourceWindow, type PeakMap } from "./clipPeakRuns";
3+
import { studioApiFetch } from "../../utils/studioApiFetch";
34

45
const peakMapRequests = new Map<string, Promise<PeakMap | null>>();
56

67
function loadPeakMap(url: string): Promise<PeakMap | null> {
78
const pending = peakMapRequests.get(url);
89
if (pending) return pending;
9-
const request = fetch(url)
10+
const request = studioApiFetch(url)
1011
.then((res) => (res.ok ? res.json() : null))
1112
.then((body: unknown) => (isPeakMap(body) ? body : null))
1213
.catch(() => null);

‎packages/studio/src/player/components/clipMenuNormalize.ts‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { resolveMediaPreviewUrl } from "./thumbnailUtils";
44
import type { TimelineElement } from "../store/timelineElement";
55
import { parseAutomation, VOLUME_TARGET } from "@hyperframes/core/audio-automation";
66
import type { TimelineEditOutcome } from "../../hooks/timelineEditPermission";
7+
import { studioApiFetch } from "../../utils/studioApiFetch";
78

89
export interface NormalizePlan {
910
targetLufs: number;
@@ -74,7 +75,7 @@ function isNormalizePlan(value: unknown): value is NormalizePlan {
7475
export async function requestNormalizePlan(
7576
projectId: string,
7677
el: TimelineElement,
77-
fetchImpl: typeof fetch = fetch,
78+
fetchImpl: typeof studioApiFetch = studioApiFetch,
7879
): Promise<NormalizePlan> {
7980
const origin = window.location.origin;
8081
const relative = resolvePreviewRelative(

0 commit comments

Comments
 (0)