[Not for merge] Perf investigation

This commit is contained in:
Dan Abramov
2021-11-07 01:26:52 +00:00
parent c29bcd7ed7
commit ae91658636
5 changed files with 9 additions and 6 deletions

View File

@@ -38,11 +38,11 @@ export function SidebarLink({
React.useEffect(() => {
if (ref && ref.current && !!selected && !isMobile) {
scrollIntoView(ref.current, {
scrollMode: 'if-needed',
block: 'center',
inline: 'nearest',
});
// scrollIntoView(ref.current, {
// scrollMode: 'if-needed',
// block: 'center',
// inline: 'nearest',
// });
}
}, [ref, selected, isMobile]);

View File

@@ -28,6 +28,7 @@ export function useTocHighlight() {
const timeoutRef = React.useRef<number | null>(null);
React.useEffect(() => {
return;
function updateActiveLink() {
const pageHeight = document.body.scrollHeight;
const scrollPosition = window.scrollY + window.innerHeight;

View File

@@ -76,7 +76,7 @@ export function Navigation({
}, [containerRef, challengesNavRef, scrollPos]);
React.useEffect(() => {
handleResize();
//handleResize();
window.addEventListener('resize', debounce(handleResize, 200));
return () => {
window.removeEventListener('resize', handleResize);

View File

@@ -38,6 +38,7 @@ const CodeBlock = React.forwardRef(
},
ref?: React.Ref<HTMLDivElement>
) => {
return <pre>lol</pre>
const getDecoratedLineInfo = () => {
if (!metastring) {
return [];

View File

@@ -64,6 +64,7 @@ ul {
`.trim();
function Sandpack(props: SandpackProps) {
return <pre>lol</pre>
let {children, setup, autorun = true} = props;
let [resetKey, setResetKey] = React.useState(0);
let codeSnippets = React.Children.toArray(children) as React.ReactElement[];