Commit 897615a4 authored by Chunchi Che's avatar Chunchi Che

Merge branch 'dev/hot-reload' into 'main'

fix: small

See merge request !379
parents 6b669d0a e744004a
Pipeline #27900 passed with stages
in 8 minutes and 27 seconds
...@@ -40,15 +40,16 @@ export const Component: React.FC = () => { ...@@ -40,15 +40,16 @@ export const Component: React.FC = () => {
// 如果处于开发时的本地文件回放模式,则重新跳回Match且保持record参数,从而开始下一轮播放 // 如果处于开发时的本地文件回放模式,则重新跳回Match且保持record参数,从而开始下一轮播放
const [searchParams] = useSearchParams(); const [searchParams] = useSearchParams();
const { DEV } = useEnv(); const { DEV } = useEnv();
const RECORD = "record";
useEffect(() => { useEffect(() => {
if (!DEV) return; if (!DEV) return;
const recordName = searchParams.get("record"); const recordName = searchParams.get(RECORD);
if ( if (
searchParams && recordName &&
matStore.selfType === ygopro.StocTypeChange.SelfType.UNKNOWN matStore.selfType === ygopro.StocTypeChange.SelfType.UNKNOWN
) { ) {
navigate(`/match?record=${recordName}`); navigate(`/match?${new URLSearchParams({ [RECORD]: recordName })}`);
} }
}, []); }, []);
......
...@@ -48,7 +48,8 @@ export const ReplayModal: React.FC = () => { ...@@ -48,7 +48,8 @@ export const ReplayModal: React.FC = () => {
// 开发时的回放模式:路径跳转到duel // 开发时的回放模式:路径跳转到duel
const [searchParams] = useSearchParams(); const [searchParams] = useSearchParams();
const { DEV } = useEnv(); const { DEV } = useEnv();
const recordName = searchParams.get("record"); const RECORD = "record";
const recordName = searchParams.get(RECORD);
// 如处于回放模式且有回放文件,则导入播放 // 如处于回放模式且有回放文件,则导入播放
useEffect(() => { useEffect(() => {
...@@ -68,7 +69,11 @@ export const ReplayModal: React.FC = () => { ...@@ -68,7 +69,11 @@ export const ReplayModal: React.FC = () => {
localStore.open = false; localStore.open = false;
localStore.hasStart = false; localStore.hasStart = false;
// 跳转 // 跳转
navigate(recordName ? `/duel?record=${recordName}` : "/duel"); navigate(
recordName
? `/duel?${new URLSearchParams({ [RECORD]: recordName })}`
: "/duel",
);
} }
}, [hasStart]); }, [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