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>
This commit is contained in:
parent
4e8e191a6e
commit
d5e122594d
3 changed files with 4 additions and 2 deletions
|
@ -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(
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { createContext, useContext } from 'react'
|
||||
|
||||
export const RefreshContext = createContext((_: any) => {})
|
||||
export const RefreshContext = createContext((_props?: any) => {})
|
||||
|
||||
export function useRefreshRoot() {
|
||||
return useContext(RefreshContext)
|
||||
|
|
Loading…
Reference in a new issue