Skip to content

Hydration for create_server_action? #1490

Answered by gbj
y-haidar asked this question in Q&A
Discussion options

You must be logged in to vote

If you ever find yourself creating an action and immediately dispatching it, you should probably be using a resource instead. If you used a resource to load the data here, it would load on the server and stream down to the client. Any data you used from it in your view behind a Suspense or Transition would appear in the HTML before the WASM had loaded.

You could then use a create_effect and Resource::set to feed the action's value into the resource.

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@y-haidar
Comment options

@y-haidar
Comment options

Answer selected by y-haidar
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants