A tool for people curious about the React Server Components protocol rscexplorer.dev/
rsc react
37
fork

Configure Feed

Select the types of activity you want to include in your feed.

make play button sticky

closes https://github.com/gaearon/rscexplorer/pull/6

Co-authored-by: Michael Chen <mchen@ixl.com>

+10 -10
+4
src/client/ui/LivePreview.css
··· 55 55 color: #ffd54f; 56 56 } 57 57 58 + .LivePreview-controlBtn--playing:hover:not(:disabled) { 59 + color: #ffe566; 60 + } 61 + 58 62 .LivePreview-controlBtn--step { 59 63 background: #ffd54f; 60 64 color: #000;
+2 -10
src/client/ui/LivePreview.tsx
··· 73 73 74 74 useEffect(() => { 75 75 if (!isPlaying || isAtEnd) { 76 - // eslint-disable-next-line react-hooks/set-state-in-effect 77 - if (isAtEnd) setIsPlaying(false); 78 76 return; 79 77 } 80 78 const timer = setTimeout(() => onStep(), 300); 81 79 return () => clearTimeout(timer); 82 80 }, [isPlaying, isAtEnd, onStep, cursor]); 83 81 84 - useEffect(() => { 85 - // eslint-disable-next-line react-hooks/set-state-in-effect 86 - setIsPlaying(false); 87 - }, [totalChunks]); 88 - 89 82 const showPlaceholder = entries.length === 0 || cursor === 0; 90 83 91 84 const handlePlayPause = (): void => setIsPlaying(!isPlaying); ··· 94 87 onStep(); 95 88 }; 96 89 const handleSkip = (): void => { 97 - setIsPlaying(false); 98 90 onSkip(); 99 91 }; 100 92 const handleReset = (): void => { ··· 131 123 </svg> 132 124 </button> 133 125 <button 134 - className={`LivePreview-controlBtn${isPlaying ? " LivePreview-controlBtn--playing" : ""}`} 126 + className={`LivePreview-controlBtn${isPlaying && !isAtEnd ? " LivePreview-controlBtn--playing" : ""}`} 135 127 onClick={handlePlayPause} 136 - disabled={isLoading || isAtEnd} 128 + disabled={isLoading} 137 129 aria-label={isPlaying ? "Pause" : "Play"} 138 130 title={isPlaying ? "Pause" : "Play"} 139 131 >
+1
src/client/ui/Workspace.tsx
··· 54 54 } 55 55 56 56 const timeline = session?.timeline ?? loadingTimeline; 57 + 57 58 const { entries, cursor, totalChunks, isAtStart, isAtEnd, isStreaming } = useSyncExternalStore( 58 59 timeline.subscribe, 59 60 timeline.getSnapshot,
+3
src/client/workspace-session.ts
··· 98 98 callServer: this.callServer.bind(this), 99 99 }); 100 100 this.timeline.addAction(actionName, argsDisplay, stream); 101 + if (stream.error) { 102 + throw stream.error; 103 + } 101 104 return stream; 102 105 } 103 106