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

Derive debug for params struct in server macro #458

Merged
merged 1 commit into from
Feb 3, 2023

Conversation

g-re-g
Copy link
Contributor

@g-re-g g-re-g commented Feb 3, 2023

Is this something worth doing? I came across wanting this while writing a little app to get more familiar with leptos. It means that all params to #[server] functions need to implement Debug but they already must implement Serialize and Deserialize so I imagine that's fine? In any case, feel free to close if not wanted / needed!

The specific use where I came across this was something like:

let pending_todos = move || {
  submissions
  .get()
  .filter(|submission| submission.pending().get())
  .into_iter()
  .map(|submission| {
      view! {cx,
      // Inspect the whole struct not just one field
       <li class="pending">{move || format!("{:?}", submission.input.get()) }</li>
      }
    })
  .collect::<Vec<_>>()
};

@g-re-g g-re-g changed the title Derive debug in server macro Derive debug for params struct in server macro Feb 3, 2023
@gbj
Copy link
Collaborator

gbj commented Feb 3, 2023

Thanks, this is useful and should be totally fine.

@gbj gbj merged commit c4e693e into leptos-rs:main Feb 3, 2023
gbj pushed a commit that referenced this pull request Mar 21, 2023
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.

None yet

2 participants