Skip to content

Commit

Permalink
Merge pull request #5295 from storybooks/fix/file-system-host
Browse files Browse the repository at this point in the history
FIX issue where storybook wouldn't be able to navigate when hosted as a file://
  • Loading branch information
ndelangen committed Jan 19, 2019
2 parents 7712e86 + 8c332af commit b5cba23
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/router/src/router.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,15 @@ interface QueryLinkProps {
children: React.ReactNode;
}

const base = document.location.pathname + '?';

const queryNavigate = (to: string) => {
navigate(`?path=${to}`);
navigate(`${base}path=${to}`);
};

// A component that will navigate to a new location/path when clicked
const QueryLink = ({ to, children, ...rest }: QueryLinkProps) => (
<Link to={`?path=${to}`} {...rest}>
<Link to={`${base}path=${to}`} {...rest}>
{children}
</Link>
);
Expand Down

0 comments on commit b5cba23

Please sign in to comment.