Skip to content

fix(folksonomy): show use counts in property suggestions - #646

Merged
teolemon merged 1 commit into
openfoodfacts:mainfrom
rishiraj38:fix/243-property-use-counts
Oct 2, 2026
Merged

teolemon merged 1 commit into
openfoodfacts:mainfrom
rishiraj38:fix/243-property-use-counts

Conversation

@rishiraj38

@rishiraj38 rishiraj38 commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

What

  • Property suggestions in the Folksonomy editor show how many products use each key again, e.g. is_original (1), which helps pick between similar keys.
  • AutocompleteSuggestion gets an optional count field that autocomplete-input renders in parentheses after the label. The count is not part of label, so filtering, exact matching and the selected value still use the bare key.
  • The editor row passes the count it already receives from /keys.
  • Added a small test for autocomplete-input rendering the count.

This follows the review on #449 (count as a field on the suggestion object, no separate map, not baked into the label) and keeps the scope to the suggestions from the issue.

Screenshot

Before / after, typing origin in the new property field:

Before After

Fixes bug(s)

Summary by CodeRabbit

  • New Features
    • Autocomplete suggestions now display their usage count in parentheses when available. Suggestions without a count remain unchanged.

Add an optional count to autocomplete suggestions and render it in
parentheses after the label, so the key selected and matched is still
the bare property name. The folksonomy editor passes the count it
already receives from /keys.

Fixes openfoodfacts#243
@vercel

vercel Bot commented Sep 24, 2026

Copy link
Copy Markdown

@rishiraj38 is attempting to deploy a commit to the openfoodfacts Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai

coderabbitai Bot commented Sep 24, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: f8da8186-261b-45e6-b3cd-b6308a924e6c

📥 Commits

Reviewing files that changed from the base of the PR and between 2b40858 and 0931bb6.

📒 Files selected for processing (4)
  • web-components/src/components/folksonomy/folksonomy-editor-row.ts
  • web-components/src/components/shared/autocomplete-input.test.ts
  • web-components/src/components/shared/autocomplete-input.ts
  • web-components/src/types/index.ts

Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

Autocomplete suggestions now support optional usage counts. Folksonomy key suggestions pass their counts to the autocomplete component, which displays defined counts in parentheses. A new test checks suggestions with counts, including zero, and suggestions without counts.

Changes

Suggestion count display

Layer / File(s) Summary
Carry and render suggestion counts
web-components/src/types/index.ts, web-components/src/components/shared/autocomplete-input.ts, web-components/src/components/folksonomy/folksonomy-editor-row.ts, web-components/src/components/shared/autocomplete-input.test.ts
AutocompleteSuggestion adds an optional count. The autocomplete component displays defined counts in parentheses, and folksonomy key suggestions pass through their counts. The test checks counts of zero and nonzero, and suggestions without a count.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~8 minutes

Change: Bug fix · Severity of issue fixed: Low

Suggested reviewers: teolemon

Merge Risk: ⚪ Minimal · up to 0931b

Property suggestions can show usage counts without changing the selected property key. No material merge-blocking risk is evident.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: displaying use counts in Folksonomy property suggestions.
Linked Issues check ✅ Passed Issue #243 requests property-use counts in parentheses to help users choose between similar properties. The PR adds optional count support to AutocompleteSuggestion, renders defined counts after t…
Out of Scope Changes check ✅ Passed The changes are limited to autocomplete count typing, rendering, Folksonomy row data mapping, and the related rendering test. These changes directly support issue #243. No unrelated change is shown.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 4…
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Commit to this branch
  • Create a new PR

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

A rabbit sees counts by each name,
In parentheses, clear and plain.
Zero gets its place in line,
No count leaves the label fine.
The carrot list is neat to scan,
Hop along, the count’s in hand!

Comment @coderabbitai help to get the list of available commands.

@github-project-automation github-project-automation Bot moved this from Todo to In Progress in 🏷️ Folksonomy Engine Oct 1, 2026
@vercel

vercel Bot commented Oct 1, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
openfoodfacts-webcomponents Ready Ready Preview Oct 1, 2026 9:39pm UTC

@VaiTon

VaiTon commented Oct 1, 2026

Copy link
Copy Markdown
Member

LGTM! @teolemon merge if it is also ok with you

@rishiraj38

Copy link
Copy Markdown
Contributor Author

Thanks for the review.

@teolemon
teolemon merged commit 47be7eb into openfoodfacts:main Oct 2, 2026
11 checks passed
@github-project-automation github-project-automation Bot moved this from In Progress to Done in 🏷️ Folksonomy Engine Oct 2, 2026
@teolemon

teolemon commented Oct 2, 2026

Copy link
Copy Markdown
Member

yes, it looks good to me, thank you @rishiraj38 👍

This branch was successfully deployed

1 active deployment
Preview — 0931bb6d Deployed Oct 1, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Reintroduce the number of uses in parentheses for the properties

3 participants