Skip to content

[0.7] Ways of creating a non-Send Resource #3312

Answered by gbj
minijackson asked this question in Q&A
Discussion options

You must be logged in to vote

The answer here depends slightly on which kind of platform you're using.

If you're using CSR, then the serialization/server-client part of Resource isn't necessary and you can use LocalResource, which doesn't have a Send bound.

If you're using SSR + hydration, then the problem is specifically that reqwest uses types that are Send on the server (and show up in docs as Send, which is confusing!) but are !Send in the WASM build. You might try taking a look at how I set this up in the hackernews example: essentially using SendWrapper on the client.

The added Send bound here is an unfortunate trade-off of allowing the reactive system and server rendering to support multithreading.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@minijackson
Comment options

Answer selected by minijackson
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