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

DH/Bug : Links format filter filters out everything #668

Merged
merged 3 commits into from
Nov 3, 2023

Conversation

cmoinier
Copy link
Collaborator

Summary

This PR fixes the behavior of the downloads filter.

Issue

When clicking on one filter and clicking again on it, the download list becomes empty.

Fix

When clicking on one filter and clicking again on it, the download list falls back to 'All' and shows all download links.

How to test

Go to a dataset with download links with multiple formats, eg : /dataset/ee965118-2416-4d48-b07e-bbc696f002c2 , and click twice on the same format filter in the downloads section.

@github-actions
Copy link
Contributor

github-actions bot commented Oct 30, 2023

Affected libs: ui-elements, feature-catalog, feature-record, feature-router, feature-search, feature-map, feature-dataviz, ui-catalog, ui-search,
Affected apps: metadata-editor, datahub, demo, webcomponents, search, map-viewer,

  • 🚀 Build and deploy storybook and demo on GitHub Pages
  • 📦 Build and push affected docker images

@coveralls
Copy link

coveralls commented Oct 30, 2023

Coverage Status

coverage: 86.617% (+3.5%) from 83.092%
when pulling e3bc5e3 on DH/link-format-filter-bug
into 2901ae6 on main.

Copy link
Collaborator

@jahow jahow left a comment

Choose a reason for hiding this comment

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

Thanks for the fix! I see two things here:

  1. The unit tests (downloads-list.component.spec.ts) would probably be a better place to test this behaviour; it looks like the toggleFilterFormat method is not actually tested there, so this looks like a good time to add tests for it 🙂 Kudos for adding an associated test though!
    (Note that you can of course keep the e2e test as well)
  2. Nested ternary operations usually only make sense for their author; it's surprisingly hard to read for anyone else. I for one would really appreciate if you could instead define an intermediate variable like bool noActiveFormat 😉

@tkohr tkohr added the bug Something isn't working label Nov 3, 2023
@jahow
Copy link
Collaborator

jahow commented Nov 3, 2023

I added a commit addressing my own comments, will merge once everything is green

@jahow jahow merged commit dbc10d3 into main Nov 3, 2023
7 checks passed
@jahow jahow deleted the DH/link-format-filter-bug branch November 3, 2023 13:03
@cmoinier cmoinier added this to the 2.0.2 milestone Nov 13, 2023
jahow pushed a commit that referenced this pull request Nov 13, 2023
chore(dh): add e2e test

feat(downloads): clarify logic, add unit tests

Backported from #668
@jahow
Copy link
Collaborator

jahow commented Nov 13, 2023

backported in 67c862f

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport 2.0.x bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants