This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <Profiler | |
| id="user-profile" | |
| onRender={( | |
| id, | |
| phase, | |
| actualTime, | |
| baseTime, | |
| startTime, | |
| commitTime, | |
| interactions |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { useState } from 'react' | |
| const SlowComponent = ({ noSlowdown }) => { | |
| const arr = [] | |
| if (!noSlowdown) { | |
| for (var i = 1000000 - 1; i >= 0; i--) { | |
| arr.push(i) | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const NotificationItem = React.memo<Props>( | |
| ({ notification, onMmarkAsRead, session }) => <div>...</div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const NotificationItem = ({ notification, onMmarkAsRead, session }: Props) => <div>...</div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const useLazyMediaLoad = media => { | |
| const [url, setUrl] = useState<?string>(null) | |
| const targetRef = useRef<?HTMLElement>(null) | |
| useEffect(() => { | |
| if (!IntersectionObserver) { | |
| thumbLoader(media).then(setUrl) | |
| } else if (targetRef.current) { | |
| let observer = new IntersectionObserver( | |
| entries => |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const ExerciseItem = ({ exercise, thumbLoader }: Props) => { | |
| const [url, setUrl] = useState<?string>(null) | |
| const thisRef = useRef<?HTMLDivElement>(null) | |
| const media = exercise.media.id | |
| useEffect(() => { | |
| if (IntersectionObserver) { | |
| let observer = new IntersectionObserver( | |
| entries => |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| rootMargin: '0px 0px 200px 0px' | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const ExerciseItem = ({ exercise }: Props) => { | |
| const [url, setUrl] = useState<?string>(null) | |
| const thisRef = useRef<?HTMLDivElement>(null) | |
| useEffect(() => { | |
| let observer = new IntersectionObserver( | |
| entries => entries.forEach(entry => { | |
| if (entry.isIntersecting) { | |
| thumbLoader(media).then(setUrl) | |
| observer = observer.disconnect() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const ExerciseItem = ({ exercise }: Props) => { | |
| const [url, setUrl] = useState<?string>(null) | |
| useEffect(() => { | |
| thumbLoader(media).then(setUrl) | |
| }, [media, thumbLoader]) | |
| return <div css={styles.thumb} style={{ backgroundImage: `url(${url})` }} /> | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const ExerciseItem = ({ exercise }: Props) => { | |
| const [url, setUrl] = useState<?string>(null) | |
| return <div css={styles.thumb} style={{ backgroundImage: `url(${url})` }} /> | |
| } |