Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: dumi2.x hash history 模式下,在独立页面中打开 demo,将跳转到 404 #1554

Closed
CJY0208 opened this issue Mar 17, 2023 · 2 comments
Labels
bug Something isn't working

Comments

@CJY0208
Copy link
Member

CJY0208 commented Mar 17, 2023

hash history 模式下,在独立页面中打开 demo,将跳转到 404

原因为 demoLink 中未携带 # 号
image

目前本地修复方式为复写 slots/PreviewerActions,手动处理 demoUrl,不过感觉可能最好是在生成 demoUrl 的地方处理最好

// .dumi\theme\slots\PreviewerActions.tsx
import React, { useMemo } from 'react'
import PreviewerActions, { IPreviewerActionsProps } from 'dumi/theme-default/slots/PreviewerActions'

export default function OverridedPreviewerActions({ demoUrl, ...props }: IPreviewerActionsProps) {
  const fixedDemoUrl = useMemo(() => demoUrl.replace(/\/~demos\//, `${window.location.pathname}#/~demos/`), [demoUrl])

  return <PreviewerActions {...props} demoUrl={fixedDemoUrl} />
}

Versions

  • dumi: 2.1.5
  • node: 14.18.3
  • npm: 6.14.15
  • OS: Win10
  • Browser: Chrome 107.0.5304.63

Steps to reproduce

What is Expected?

What is actually happening?

@CJY0208 CJY0208 added the bug Something isn't working label Mar 17, 2023
@PeachScript
Copy link
Member

dumi 2 目前是不支持 hash 模式的,hash 模式问题统一合并到一个 issue 讨论吧

@PeachScript
Copy link
Member

Duplicate of #1553

@PeachScript PeachScript marked this as a duplicate of #1553 Mar 17, 2023
@PeachScript PeachScript closed this as not planned Won't fix, can't repro, duplicate, stale Mar 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants