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

docs: showcase let syntax in for_loop #3383

Merged
merged 2 commits into from
Dec 20, 2024
Merged

docs: showcase let syntax in for_loop #3383

merged 2 commits into from
Dec 20, 2024

Conversation

purung
Copy link
Contributor

@purung purung commented Dec 18, 2024

I thought it would be a boon for DX to showcase the let syntax for the <For> component.

I knew there were some improvements, but I erroneously tried the legacy let:item style to destructure my struct and had to go looking for docs. It was kind of hard to find so I thought I'd try to contribute 😅 Please, edit and adjust to your liking.

I think this should close #3059

See cousin PR for the book.

@gbj
Copy link
Collaborator

gbj commented Dec 19, 2024

Thanks for the PR! I think this is a good idea. 3 of the 4 CI failures here are unrelated (semver, autofix, and any_spawner), but the leptos one is caused by the PR and needs a fix: specifically, the doctests don't compile because they're missing imports and the view macro.

It's good to have these and they double as regression tests. You should just need to add the prelude import and also a view! { wrapping the two examples and it should be fine. (You can comment these out with a # at the beginning of the line so they don't show up in the docs.) I'd recommend running cargo test locally (in the leptos crate) to make sure you've got it right.

@purung
Copy link
Contributor Author

purung commented Dec 19, 2024

Thank you for the guidance! Tests pass locally now. I chose to keep whole snippets of view! {}. Let me know if you'd like me to reconsider the crop.

@gbj
Copy link
Collaborator

gbj commented Dec 20, 2024

Thank you!

@gbj gbj merged commit 65798e4 into leptos-rs:main Dec 20, 2024
71 of 74 checks passed
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

Successfully merging this pull request may close these issues.

Destructuring let attribute in <For> component
2 participants