Unverified Commit d5e12259 authored by Jiachi Liu's avatar Jiachi Liu Committed by GitHub

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: 's avatarShu Ding <g@shud.in>
Co-authored-by: 's avatarShu Ding <g@shud.in>
parent 4e8e191a
......@@ -88,6 +88,8 @@ export default function Search() {
<SearchUI
onChange={() => {
refresh()
// Or refresh with updated props:
// refresh(nextProps)
}}
/>
)
......
......@@ -808,7 +808,7 @@ if (process.env.__NEXT_RSC) {
const startTransition = (React as any).startTransition
const rerender = () => dispatch({})
// If there is no cache, or there is serialized data already
function refreshCache(nextProps: any) {
function refreshCache(nextProps?: any) {
startTransition(() => {
const currentCacheKey = getCacheKey()
const response = createFromFetch(
......
import { createContext, useContext } from 'react'
export const RefreshContext = createContext((_: any) => {})
export const RefreshContext = createContext((_props?: any) => {})
export function useRefreshRoot() {
return useContext(RefreshContext)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment