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

Prevent trailing commas when field list ends in non-widget fields in EditFoo.svelte template #126

Merged
merged 1 commit into from
Sep 22, 2023

Conversation

pdaoust
Copy link
Collaborator

@pdaoust pdaoust commented Sep 22, 2023

This is not the most elegant way to do things -- it duplicates data; implementing a filter helper for Handlebars would've been much more elegant. But the advantage of this approach is that I can actually do it ;)

I'm working on a possibly better solution that involves writing a filter Handlebars helper, but I'd like to get things unblocked for the hackathon this weekend

@pdaoust pdaoust changed the title Guard against trailing non-widget fields in EditFoo.svelte template Prevent trailing commas when field list ends in non-widget fields in EditFoo.svelte template Sep 22, 2023
@pdaoust pdaoust changed the base branch from main to holochain-0.1 September 22, 2023 20:10
Copy link
Collaborator

@robbiecarlton robbiecarlton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

one non blocking suggestion

Comment on lines +104 to +111
let widget_fields = fields
.iter()
.map(|f| f.clone())
.filter(|f| match f.widget {
Some(_) => true,
None => false
})
.collect();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
let widget_fields = fields
.iter()
.map(|f| f.clone())
.filter(|f| match f.widget {
Some(_) => true,
None => false
})
.collect();
let widget_fields = fields.clone()
.iter()
.filter(|f| match f.widget {
Some(_) => true,
None => false
})
.collect();

Less code, and I'm not 100% but I think it will also be marginally more efficient

@robbiecarlton robbiecarlton merged commit d873219 into holochain-0.1 Sep 22, 2023
2 checks passed
@robbiecarlton robbiecarlton deleted the 2023-09-22-fix-edit-foo branch September 22, 2023 21:51
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.

2 participants