Commit e744004a authored by timel's avatar timel

fix: small

parent e2380147
Pipeline #27561 passed with stages
in 8 minutes and 19 seconds
......@@ -40,15 +40,16 @@ export const Component: React.FC = () => {
// 如果处于开发时的本地文件回放模式,则重新跳回Match且保持record参数,从而开始下一轮播放
const [searchParams] = useSearchParams();
const { DEV } = useEnv();
const RECORD = "record";
useEffect(() => {
if (!DEV) return;
const recordName = searchParams.get("record");
const recordName = searchParams.get(RECORD);
if (
searchParams &&
recordName &&
matStore.selfType === ygopro.StocTypeChange.SelfType.UNKNOWN
) {
navigate(`/match?record=${recordName}`);
navigate(`/match?${new URLSearchParams({ [RECORD]: recordName })}`);
}
}, []);
......
......@@ -46,7 +46,8 @@ export const ReplayModal: React.FC = () => {
// 开发时的回放模式:路径跳转到duel
const [searchParams] = useSearchParams();
const { DEV } = useEnv();
const recordName = searchParams.get("record");
const RECORD = "record";
const recordName = searchParams.get(RECORD);
// 如处于回放模式且有回放文件,则导入播放
useEffect(() => {
......@@ -66,7 +67,11 @@ export const ReplayModal: React.FC = () => {
localStore.open = false;
localStore.hasStart = false;
// 跳转
navigate(recordName ? `/duel?record=${recordName}` : "/duel");
navigate(
recordName
? `/duel?${new URLSearchParams({ [RECORD]: recordName })}`
: "/duel",
);
}
}, [hasStart]);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment