Repository navigation
fix(tools): show tools without languages when grouping by language - #2633
Closed
NopeCharon wants to merge 1 commit into
Closed
NopeCharon wants to merge 1 commit into
NopeCharon wants to merge 1 commit into
Conversation
When the tools page was grouped by language, `groupTools` only placed a tool in a group if it defined at least one value for the attribute being grouped by. Tools without `languages` (49 of the 282 entries, such as online validators, CLIs and editors) were silently dropped, so switching the "Group By" option from "Tool Type" to "Language" made tools disappear. With the "Validator" filter applied, 15 of the 90 validators were missing. Tools that have no value for the grouped attribute are now listed under an "Other" group, which is always shown after all the other groups, so every tool matching the filters stays visible regardless of how the list is grouped. `numberOfTools` now simply reflects the number of tools passed in, since every tool ends up in a group. The "N Tools" count also summed the size of every group, so a tool listed under several languages or tooling types was counted once per group (the 90 validators were reported as 125 when grouped by tool type and 87 when grouped by language). The count now uses the number of unique visible tools, so it is the same for every grouping. Add component tests covering the Other group, its position, grouping by tooling type, and the de-duplicated tool count.
built with Refined Cloudflare Pages Action⚡ Cloudflare Pages Deployment
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2633 +/- ##
============================================
- Coverage 100.00% 66.69% -33.31%
============================================
Files 31 38 +7
Lines 737 1273 +536
Branches 229 438 +209
============================================
+ Hits 737 849 +112
- Misses 0 424 +424 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What kind of change does this PR introduce?
Bugfix
Issue Number:
Screenshots/videos:
No visual changes other than a new "Other" section at the bottom of the tools list when grouping by Language. With the "Validator" filter applied:
If relevant, did you update the documentation?
Not needed, no documented behaviour changes.
Summary
On
/tools,groupToolsonly put a tool in a group if it had at least one value for the attribute being grouped by. Tools withoutlanguages(49 of the 282 entries, for example online validators like jschon.dev, CLIs like ajv-cli, and most editors) were dropped when grouping by Language. With the Validator filter, 15 of the 90 validators disappeared as soon as the grouping was switched from Tool Type to Language.Changes:
pages/tools/hooks/useToolsTransform.tsx: tools with no value for the grouped attribute go into anOthergroup (OTHER_GROUP), which is always sorted after the other groups.numberOfToolsis nowtools.length, because every tool lands in a group.pages/tools/components/ToolingTable.tsx: the "N Tools" count added up the size of every group, so a tool listed under several languages or tooling types was counted once per group. That is why the same 90 validators showed as 125 in one view and 87 in the other. The count now uses the number of unique visible tools, so it's the same for every grouping, as the issue expects.cypress/components/ToolingTable.cy.tsx: new component tests for the Other group and its position, for grouping by tooling type, and for the de-duplicated count. The tests fail onmainand pass with this change.Validation:
yarn lint,yarn typecheckand the new spec pass, along with the existing tools-page specs (SearchBar, DropdownMenu, Tag, Badge). I also ran the dev server and checked/tools?groupBy=languages&toolingTypes=validatorin Cypress against the realtooling-data.yaml. Both groupings show "90 Tools", "Other" is the last group, and "Load More" expands it to all 15 tools.Does this PR introduce a breaking change?
No.
Checklist
Please ensure the following tasks are completed before submitting this pull request.