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

Leptos Book - Reader Feedback: Please Comment Here #48

Open
diversable opened this issue Jan 17, 2024 · 11 comments
Open

Leptos Book - Reader Feedback: Please Comment Here #48

diversable opened this issue Jan 17, 2024 · 11 comments

Comments

@diversable
Copy link
Contributor

If you have feedback while reading the Leptos book (if something is unclear, or you have suggestions for improvement, etc), please leave a comment on this issue.

Your feedback is greatly appreciated.

Sincerely,

@diversable / Daniel

@ydirson
Copy link

ydirson commented Jan 17, 2024

My notes:

in https://book.leptos.dev/view/05_forms.html#uncontrolled-inputs maybe something is missing: the first code block uses Input without explaining where it comes from (though we can likely guess guess a bit, pointers to the other types that could be used in NodeRef<...> could be nice) - use leptos::html::Input can be found in the CodeSandbox example but that's much further down the page

It could be useful to move the existing CodeSandbox closer to the code it's showcasing, and maybe use a second one for the <select> example

maybe it would be easier to understand the on_submit callback, by showing the view! {...} code first: at first read I missed the link between input_element and the actual element

in https://book.leptos.dev/view/05_forms.html#textarea, untrack() is used without getting explained

last example in https://book.leptos.dev/view/05_forms.html#select uses a syntax that was not introduced first: <SelectOption value ...>

thinking I had understood the latter I tried to replace <progress max=max ...> with max in the example from https://book.leptos.dev/view/03_components.html but this seems to be interpreted as max=0 instead, maybe a word on this would be useful: I did not even realize I was comparing different beasts, precisely since components do look like elements

@tahoeschrader
Copy link

My one piece of feedback at the moment is that I'm looking forward to a page on using Leptos with Tauri

@ydirson
Copy link

ydirson commented Jan 18, 2024

In https://book.leptos.dev/reactivity/working_with_signals.html#getting-and-setting, "Take a look at the with! docs, and..." would be nice with a link to that doc

In https://book.leptos.dev/reactivity/14_create_effect.html#explicit-cancelable-tracking-with-watch:

  • similarly create_resource was not previously mentioned, and seems to call for a link to its doc
  • it mentions argument deps and callback but it is not obvious which is which (though watch is linked to its doc so we can get to the info)
  • the name deps hints that multiple deps can be specified, but all examples seem to show only one such dep - I would try with a tuple, but maybe there are recommendations

@cldershem
Copy link

cldershem commented Feb 3, 2024

I had a similar issue as someone already stated previously...in 3.6 Input and SubmitEvent come out of nowhere.

I also didn't really care for 3.4's explanation of <For>. Almost all of that is done in a code example with just comments and it doesn't really have the same depth as I think it might need. It's a little difficult to follow.

In the router section the sentence at the beginning is incomplete. "First things first, make sure you’ve added the leptos_router package to your dependencies." doesn't mention that you are required to add at least 1 feature to leptos_router.

@ydirson
Copy link

ydirson commented Feb 7, 2024

In https://book.leptos.dev/router/16_routes.html#defining-routes-1 the example description states "If you go to /users/3 or /blahblah you’ll get a user profile or your 404 page", it is not obvious why the <Route path="/users/:id" view=UserProfile/> would not take care of the former.

Also the allowed ways to assemble the fragments in Route doc is not necessarily obvious. Especially I'm still baffled by the *any fragment that appears as exemple both in the book and in the doc - that can look like a usual pattern matching "any chars then literal a, n, y, but as that would be a bit arbitrary it could as easily be some sort of "magical string".

@ydirson
Copy link

ydirson commented Feb 7, 2024

Trying to play with routes, when I finally get a first app to compile, I get a runtime failure teaching You must call use_router() within a <Router/> component Location (sic, the line pointed to calls use_query)

Both https://book.leptos.dev/router/16_routes.html#providing-the-router and https://docs.rs/leptos_router/latest/leptos_router/fn.Router.html# give very little info on the role of this component. I did place it "near the root of the application", but nothing told me that I would not be able to call use_query from my root component.

@Wollaston
Copy link
Contributor

Wollaston commented Feb 26, 2024

Hi all,

First, thank you for the work to put this book together. It has been really helpful in using Leptos of course, but also in using certain Rust concepts in both a practical and a Wasm context.

A few thoughts and suggestions from me, based on documentation I have read outside of the book that I think would be helpful if included in some manner within the book (from my review, these were not in the book - apologies if I missed something). I am happy to make a PR to add any or all of these, and I can split this list off into its own tracking issue if that would be helpful. Just let me know whatever is preferred and most helpful for you. I deferred to starting in this thread before opening anything new.

Some of these are noted in other threads already and in open issues, but at least for me, I wanted to volunteer myself to tackle the list below that I came across in my own work and wanted a section in the book for.

  • Add a section on more advanced Leptos components

    • There are a lot of interesting and more-advanced Leptos components that do not get a mention/example in the book but are usually documented elsewhere (e.g., an issue in the main repo, docs.rs, a release announcement, Discord, etc). I think it would be helpful if a short explanation is included in the book to bring awareness to these components as I think the book is, for some, the first place to go for documentation or learn what is available (esp. for first time users). A few examples:
  • Other functionality worth noting

    • Directives usage example (this does get a small mention in ch. 12 and is also mentioned in release v0.5.2)
    • Extend 15 - Working with the Server by adding section/example on ServerFnError::new() and #[middleware] (see e.g. release v0.6.1)
      • The ServerFnError personally tripped me up, and I think the #[middleware] feature and the comprehensive server_fns_axum example deserve a reference
  • Add additional details and links on the Leptos Community

    • A lot of awesome stuff keeps coming up in the Leptos Community that I think would be great to link to in the book
      • The Leptos YouTube channel and the Leptos Monthly Meetups (thanks to everyone for putting those together - a lot of great information contained in those talks)
      • The Leptos Community GitHub Repo which seems new and like a WIP, but as the community grows and new, more domain-specific tutorials emerge that do not quite fit in the main repo but deserve to be organized with similar examples/tutorials, it would be great if the book points people that way

Again, I can make a new tracking issue for whatever people think should be added to the book, and then make those PRs in turn. But before heading down that path, I wanted to make sure others thought it made sense to include these items. In my opinion, since these are part of core Leptos, it makes sense to have them at least introduced in the main book. I don't think it will add too much maintenance burden, since it's mostly just consolidating existing documentation and examples to the book, but I would love to hear what core maintainers think, and then I can adjust accordingly. Thank you again!

@akiross
Copy link

akiross commented Mar 8, 2024

Hello, I'm at the very beginning of looking into leptos and it looks cool!
Just a simple question, which came natural to me, but I didn't find mentioned while reading: in https://book.leptos.dev/view/01_basic_component.html#a-basic-component why use the update method instead of the more intuitive following code?

move |_| { set_count(count() + 1); }

I tried and it works, it even makes sense given what it is said in that chapter, but I guess there are some gotchas that I probably can't see now, related to borrowing or moving. Here's the code I've being play with:

use leptos::*;

fn main() {
    let (count, set_count) = create_signal(0);

    mount_to_body(move || {
        view! {
            <input type="text" on:input=move |_| { set_count(count() + 1) }/>
            <p>{ move || count() } "keystrokes"</p>
        }
    })
}

Edit:

I found an answer on the reference doc, where it seems possible, but it is not efficient. I think it's worth to mention that in the book as well and maybe explain why it is not efficient.

@ydirson
Copy link

ydirson commented Mar 8, 2024

I think it's worth to mention that in the book as well and maybe explain why it is not efficient.

The book has some explanations spread in this page which also points to reference doc. Maybe the reference doc could be enriched to make things clear there too?

@connec
Copy link

connec commented Jun 25, 2024

Unless I'm missing something, the documentation for <select> is misleading, or at least a bit too strong, when it comes to the value property.

The element also does not have a value attribute, nor a value property. Instead, its value is determined by the selected attribute of its fields. Some frameworks obscure this with a value field on ; if you try this in Leptos (or vanilla JavaScript) it won’t work.

I haven't tried to use it in Leptos, so I can't confirm or deny the last point, but the value property for HTMLSelectElement is documented:

The HTMLSelectElement.value property contains the value of the first selected <option> element associated with this <select> element.

This property can also be set directly, for example to set a default value based on some condition.

@gbj
Copy link
Contributor

gbj commented Jun 25, 2024

Unless I'm missing something, the documentation for <select> is misleading, or at least a bit too strong.

Thanks, I've updated that section and example.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants