leptos-rs / book

The home for the Leptos book, which can be found deployed at https://book.leptos.dev
MIT License
59 stars 58 forks source link

Add notice to ensure wasm target is installed under setup-page for SSR apps #102

Closed Crowdedlight closed 1 month ago

Crowdedlight commented 1 month ago

Right now the setup/get started for CSR setups includes a line of "remember to add wasm target". While the SSR setup instructions do not.

Logically speaking if you use the book from one end to the other, you would have added it in CSR and thus don't need it in SSR. But for users that know they want to make an SSR app, they might skip the CSR setup (like me), and go straight to SSR, and then running the commands there will give a large amount of errors:

error[E0425]: cannot find function, tuple struct or tuple variant `Some` in this scope
    --> /home/fm/.cargo/registry/src/index.crates.io-6f17d22bba15001f/hashbrown-0.14.5/src/map.rs:4915:29
     |
4915 |             Some((_, v)) => Some(v),
     |                             ^^^^ not found in this scope

I missed the step in CSR setup, and forgot about the obvious part of making a webapp require the wasm target to be installed, so I had to search on your discord before I found the answer. (My first time doing a web target with rust)

So I think repeating that small bit of instruction with the same wording as CSR setup, is worth it on SSR setup page :)

Current SSR setup page: image

gbj commented 1 month ago

Happy to include this in the docs. I would very strongly recommend not skipping the first half of the book -- Maybe you mean skipping ahead to the cargo-leptos install instructions and then going back to the beginning.

(Also a side note: Rust errors can be hard to understand when there are so many of them, but IIRC the recommendation to install the wasm32-unknown-unknown target is displayed near the top of the error text)

Crowdedlight commented 1 month ago

Happy to include this in the docs. I would very strongly recommend not skipping the first half of the book -- Maybe you mean skipping ahead to the cargo-leptos install instructions and then going back to the beginning.

(Also a side note: Rust errors can be hard to understand when there are so many of them, but IIRC the recommendation to install the wasm32-unknown-unknown target is displayed near the top of the error text)

Yeah, I formulated myself badly. Meant skipping to SSR for install and initial setup, then jump back to the first part to learn about the user interfaces, reactivity, async, routing, etc. :)

Ah fair, I had so many lines of errors that I gave up on scrolling up and seeing the first errors, as all the others seemed to be identical. So I probably missed that part of the error message 😅