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

Fix rendering of empty extra_fields div #542

Merged
merged 5 commits into from
Sep 9, 2024
Merged

Fix rendering of empty extra_fields div #542

merged 5 commits into from
Sep 9, 2024

Conversation

glenn-sorrentino
Copy link
Member

Motivation:
On accounts with no extra fields defined, the containing div was still rendering.

Example:
Screenshot 2024-09-06 at 8 00 59 PM

Fix:
In the original code, the if condition checked for defined labels and values, but the div still rendered even if no valid fields existed. Introduced valid_fields, a filtered list of extra_fields using selectattr('value'), which removes fields without valid values. This ensures only fields with both defined label and non-empty value are processed.

Instead of just rendering the div based on the presence of any label/value, I added valid_fields | length > 0 to check if any valid fields exist before rendering the div. This prevents rendering an empty div.

Updated Screenshot:
Screenshot 2024-09-06 at 8 04 21 PM

@glenn-sorrentino glenn-sorrentino merged commit f79113b into main Sep 9, 2024
7 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.

2 participants