Skip to content

Commit d5e1225

Browse files
huozhishuding
andauthored
Update rsc refresh typing and doc example (#35543)
* Update rsc refresh typing and doc example * Update docs/api-reference/next/streaming.md Co-authored-by: Shu Ding <g@shud.in> Co-authored-by: Shu Ding <g@shud.in>
1 parent 4e8e191 commit d5e1225

3 files changed

Lines changed: 4 additions & 2 deletions

File tree

docs/api-reference/next/streaming.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,8 @@ export default function Search() {
8888
<SearchUI
8989
onChange={() => {
9090
refresh()
91+
// Or refresh with updated props:
92+
// refresh(nextProps)
9193
}}
9294
/>
9395
)

packages/next/client/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -808,7 +808,7 @@ if (process.env.__NEXT_RSC) {
808808
const startTransition = (React as any).startTransition
809809
const rerender = () => dispatch({})
810810
// If there is no cache, or there is serialized data already
811-
function refreshCache(nextProps: any) {
811+
function refreshCache(nextProps?: any) {
812812
startTransition(() => {
813813
const currentCacheKey = getCacheKey()
814814
const response = createFromFetch(

packages/next/client/streaming/refresh.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { createContext, useContext } from 'react'
22

3-
export const RefreshContext = createContext((_: any) => {})
3+
export const RefreshContext = createContext((_props?: any) => {})
44

55
export function useRefreshRoot() {
66
return useContext(RefreshContext)

0 commit comments

Comments
 (0)