Skip to content

Commit a042817

Browse files
committed
fix: "use client" for alphaTAb
1 parent 2002b58 commit a042817

File tree

4 files changed

+13
-6
lines changed

4 files changed

+13
-6
lines changed

src/components/AlphaTabFull/index.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
'use client';
2+
13
import * as alphaTab from "@coderline/alphatab";
24
import React, { useEffect, useRef, useState } from "react";
35
import { PlayerControlsGroup } from "./player-controls-group";

src/components/AlphaTexSample/index.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
'use client';
2+
13
import React from "react";
24
import CodeBlock from "@theme/CodeBlock";
35
import { AlphaTab } from "../AlphaTab";

src/components/RasgueadoPatterns/index.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
'use client';
12
import * as alphaTab from "@coderline/alphatab";
23
import { useEffect, useRef } from "react";
34
import styles from "./styles.module.scss";

src/environment.ts

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,14 @@ export default {
55
settings.core.fontDirectory = "/font/";
66
settings.player.soundFont = "/soundfont/sonivox.sf3";
77

8-
const params = new URL(window.location.href).searchParams;
9-
settings.fillFromJson({
10-
core: {
11-
logLevel: (params.get('loglevel') ?? 'info') as keyof typeof alphaTab.LogLevel
12-
}
13-
})
8+
if (typeof window !== 'undefined') {
9+
const params = new URL(window.location.href).searchParams;
10+
settings.fillFromJson({
11+
core: {
12+
logLevel: (params.get('loglevel') ?? 'info') as keyof typeof alphaTab.LogLevel
13+
}
14+
})
15+
}
1416

1517
settings.display.resources.copyrightFont.families = ["Noto Sans"];
1618
settings.display.resources.titleFont.families = ["Noto Serif"];

0 commit comments

Comments
 (0)