Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update rsc refresh typing and doc example #35543

Merged
merged 3 commits into from Mar 25, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions docs/api-reference/next/streaming.md
Expand Up @@ -88,6 +88,8 @@ export default function Search() {
<SearchUI
onChange={() => {
refresh()
// Or refresh with updated props:
// refresh(nextProps)
}}
/>
)
Expand Down
2 changes: 1 addition & 1 deletion packages/next/client/index.tsx
Expand Up @@ -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(
Expand Down
2 changes: 1 addition & 1 deletion packages/next/client/streaming/refresh.ts
@@ -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)
Expand Down