Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

rough outline for RSC prefetching#4676

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Draft
phryneas wants to merge1 commit intopr/rsc
base:pr/rsc
Choose a base branch
Loading
frompr/rsc-preloading

Conversation

@phryneas
Copy link
Member

@phryneasphryneas commentedOct 27, 2024
edited
Loading

This would enable manual endpoint prefetching from Server Components:

functionPage(){return(<PrefetchEndpointsbaseQuery={baseQuery}run={async(prefetch)=>{// immediate prefetchingconstpromise1=prefetch(api.endpoints.foo,'bar')constpromise2=prefetch(api.endpoints.foo,'baz')// and a "dependent endpoint" that can only be prefetched with the result of the first twoconstresult1=awaitpromise1constresult2=awaitpromise2prefetch(api.endpoints.foo,result1+result2)}}>      foo</PrefetchEndpoints>)}

Drawbacks:

  • as RTK currently doesn't have suspense, this will still render a loading state in SSR. We could add a "blocking" boolean option that could be set on the RSC side e.g. when a crawler request is detected to finish all requests before handing off to client components, so the SSR run would render the final data

belgattitude reacted with heart emoji
@codesandbox
Copy link

Review or Edit in CodeSandbox

Open the branch inWeb EditorVS CodeInsiders

OpenPreview

@codesandbox-ci
Copy link

This pull request is automatically built and testable inCodeSandbox.

To see build info of the built libraries, clickhere or the icon next to each commit SHA.

Latest deployment of this branch, based on commitc9756bd:

SandboxSource
@examples-query-react/basicConfiguration
@examples-query-react/advancedConfiguration
@examples-action-listener/counterConfiguration
rtk-esm-craConfiguration

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

2 participants

@phryneas

[8]ページ先頭

©2009-2025 Movatter.jp