소스 검색

docs: share fix scroll to anchor

Jay V 1 년 전
부모
커밋
167a9dcaf3
1개의 변경된 파일과 6개의 추가작업 그리고 1개의 파일을 삭제
  1. 6 1
      packages/web/src/components/Share.tsx

+ 6 - 1
packages/web/src/components/Share.tsx

@@ -957,7 +957,12 @@ export default function Share(props: {
 
                         onMount(() => {
                           const hash = window.location.hash.slice(1)
-                          if (hash !== "" && hash === anchor()) {
+                          // Wait till all parts are loaded
+                          if (
+                            hash !== ""
+                            && msg.parts.length === partIndex() + 1
+                            && data().messages.length === msgIndex() + 1
+                          ) {
                             scrollToAnchor(hash)
                           }
                         })