Skip to content

Commit

Permalink
fix: missing router base for demo url
Browse files Browse the repository at this point in the history
  • Loading branch information
PeachScript committed Nov 16, 2022
1 parent 592e7e3 commit 3d71a04
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/client/theme-api/DumiDemo.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { SP_ROUTE_PREFIX } from '@/constants';
import { useSiteData } from 'dumi';
import { useAppData, useSiteData } from 'dumi';
import Container from 'dumi/theme/builtins/Container';
import Previewer from 'dumi/theme/builtins/Previewer';
import React, { createElement, type FC, type ReactNode } from 'react';
Expand Down Expand Up @@ -38,6 +38,7 @@ const DemoErrorBoundary: FC<{ children: ReactNode }> = (props) => (

export const DumiDemo: FC<IDumiDemoProps> = (props) => {
const { demos } = useSiteData();
const { basename } = useAppData();
const { component, asset } = demos[props.demo.id];

if (props.demo.inline) {
Expand All @@ -50,7 +51,7 @@ export const DumiDemo: FC<IDumiDemoProps> = (props) => {
demoUrl={
// allow user override demoUrl by frontmatter
props.previewerProps.demoUrl ||
`/${SP_ROUTE_PREFIX}demos/${props.demo.id}`
`${basename}${SP_ROUTE_PREFIX}demos/${props.demo.id}`
}
{...props.previewerProps}
>
Expand Down

0 comments on commit 3d71a04

Please sign in to comment.