File tree Expand file tree Collapse file tree 6 files changed +58
-0
lines changed
packages/plugin-rsc/examples/basic/src/routes Expand file tree Collapse file tree 6 files changed +58
-0
lines changed Original file line number Diff line number Diff line change 1+ 'use client'
2+
3+ import React from 'react'
4+ import { clientDep } from './client-dep'
5+ import { ClientDepComp } from './client-dep-comp'
6+
7+ export function TestHmrClientDepA ( ) {
8+ const [ count , setCount ] = React . useState ( 0 )
9+ return (
10+ < >
11+ < span data-testid = "test-hmr-client-dep3" >
12+ < button onClick = { ( ) => setCount ( ( c ) => c + 1 ) } >
13+ test-hmr-client-dep3: { count }
14+ </ button >
15+ { clientDep ( ) }
16+ < ClientDepComp />
17+ </ span >
18+ </ >
19+ )
20+ }
Original file line number Diff line number Diff line change 1+ 'use client'
2+
3+ import { TestHmrClientDepA } from './client-a'
4+
5+ export function TestHmrClientDepB ( ) {
6+ return < TestHmrClientDepA />
7+ }
Original file line number Diff line number Diff line change 1+ export function ClientDepComp ( ) {
2+ return '[ok]'
3+ }
Original file line number Diff line number Diff line change 1+ export function clientDep ( ) {
2+ return '[ok]'
3+ }
Original file line number Diff line number Diff line change 1+ import { TestHmrClientDepA } from './client-a'
2+ import { TestHmrClientDepB } from './client-b'
3+
4+ // example to demonstrate a folowing behavior
5+ // https://github.com/vitejs/vite-plugin-react/pull/788#issuecomment-3227656612
6+ /*
7+ server server
8+ | |
9+ v v
10+ client-a client-a?t=xx <-- client-b
11+ | |
12+ v v
13+ client-dep-comp?t=xx
14+ */
15+
16+ export function TestHmrClientDep3 ( ) {
17+ return (
18+ < div >
19+ < TestHmrClientDepA />
20+ < TestHmrClientDepB />
21+ </ div >
22+ )
23+ }
Original file line number Diff line number Diff line change @@ -42,6 +42,7 @@ import { TestTreeShakeServer } from './tree-shake/server'
4242import { TestClientChunkServer } from './chunk/server'
4343import { TestTailwind } from './tailwind'
4444import { TestHmrClientDep2 } from './hmr-client-dep2/client'
45+ import { TestHmrClientDep3 } from './hmr-client-dep3/server'
4546
4647export function Root ( props : { url : URL } ) {
4748 return (
@@ -66,6 +67,7 @@ export function Root(props: { url: URL }) {
6667 < TestHydrationMismatch url = { props . url } />
6768 < TestHmrClientDep url = { { search : props . url . search } } />
6869 < TestHmrClientDep2 url = { { search : props . url . search } } />
70+ < TestHmrClientDep3 />
6971 < TestHmrSharedServer />
7072 < TestHmrSharedClient />
7173 < TestHmrSharedAtomic />
You can’t perform that action at this time.
0 commit comments