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

OCLOMRS-1047:List of concepts - Text search and filters don't work anymore #743

Closed
wants to merge 5 commits into from

Conversation

suruchee
Copy link
Contributor

@suruchee suruchee commented Sep 14, 2021

JIRA TICKET NAME:

Clear Filters button does not work well

Summary:

  • Fixes the Clear Filter button functionality

@coveralls
Copy link

coveralls commented Sep 14, 2021

Coverage Status

Coverage increased (+0.01%) to 46.68% when pulling 67a8a23 on suruchee:OCLOMRS-1047 into 04efed8 on openmrs:master.

includeAdded: generalFilters.includes("Include Added Concepts")
});
}
retrieveConcepts({
Copy link
Contributor

Choose a reason for hiding this comment

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

thanks @suruchee have you also tested on a working instance of ocl

Copy link
Collaborator

@hadijahkyampeire hadijahkyampeire 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 @suruchee , it is working well but I tried to keep most of what we had and only add the necessary dependencies to the useEffect and it still works, let's do that so that we don't break some other parts.

useEffect(() => {
setContainerUrl(url.replace("/concepts", ""));
}, [url]);
const containerUrl = url.replace("/concepts", "");
Copy link
Collaborator

Choose a reason for hiding this comment

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

We might not need to remove this useEffect, it might cause some bugs

containerType === SOURCE_VERSION_CONTAINER
? retrieveSource(containerUrl)
: retrieveDictionary(containerUrl);
// we don't make this reactive(only depend on the initial values), because the requirement
Copy link
Collaborator

Choose a reason for hiding this comment

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

Also let's keep this if condition so that it only runs when there is a url

}, [retrieveConcepts, retrieveDictionary, retrieveSource, containerUrl]);

}, [
retrieveConcepts,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why did you remove the retrieveDictionary, retrieveSource and containerUrl, let's keep them there, the only problem was that we were not including the initialQ, url, page, limit and there other params in the dependecies, with that only change it works as expected, so let's keep what was there and add url, page, limit, initialQ and others that way we won't affect some other work or have bugs.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks, @hadijahkyampeire, I have updated with your suggestions.

@hadijahkyampeire
Copy link
Collaborator

Also, the ClearFilters button is not working, we should create a follow-up ticket to have that work again cc @suruchee

Copy link
Collaborator

@hadijahkyampeire hadijahkyampeire left a comment

Choose a reason for hiding this comment

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

LGTM, thanks for the fix.

@hadijahkyampeire
Copy link
Collaborator

hadijahkyampeire commented Sep 14, 2021

@suruchee this same work has been covered in @jwnasambu PR, you should rebase and maybe make this PR fix the clear filters bug.

@suruchee
Copy link
Contributor Author

Hi @ibacher and @hadijahkyampeire, the clear all button works with the code changes but only works in double click, I also tried changing dependency in viewConceptsPage but did not work. Can you guys have a look?


const clearAllFilters = () => {
setCheckedClasses([]);
setCheckedDataTypes([]);
setCheckedGeneral([]);
setCheckedSources([]);
goTo(url);
Copy link
Member

Choose a reason for hiding this comment

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

I actually wonder about this... Right now the behaviour is that I click each filter and then click the "APPLY FILTERS" link to actually update the view. The logic behind the way the "CLEAR ALL" button currently work is that it's just clearing the filters as if you had cleared them manually. You still need to click "APPLY FILTERS" for the changes to make.

I think the question is: is the user experience expectation that clicking on the "CLEAR ALL" button removes all the filters and updates the table, or do we want to just clear all the filters and let the updating of the table take place after the user has reset their filters.

There are two reasons I might click on the "CLEAR ALL" button:

  1. I really want to go back to the view of all concepts.
  2. I just want to clear out the filters I previously had so I can create a new set of filters.

This new behaviour obviously makes the flow easy for 1, but is it the right flow for 2?

And in either case, I would update this PR to reflect what this change actually does (i.e. reloads the table when clicking "CLEAR ALL") rather than the now disconnected ticket it was first attached to.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I think the "CLEAR Filter" button should remove all the filters, update the url and make a request since the URL has changed so that the user goes back to the view without filters but we should remember to keep page and q since they are not attached to the other filters.

Copy link
Member

Choose a reason for hiding this comment

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

q makes sense to keep, but not page if we're making a new query (why would I want to be on page 5 of all the concepts after having been on page 5 of all the question concepts?)

Copy link
Collaborator

Choose a reason for hiding this comment

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

That would be great @ibacher if you can update this PR with that fix, I will update the ticket description to capture the clear filter changes.

Copy link
Collaborator

Choose a reason for hiding this comment

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

You are right @ibacher , now I see it for the page setting to 1, though given where the clear filters button is placed it looks like it's only for clearing the filters in the sideBar and not anything else. But I think that's a minor UX thing, now that I think of it, it's probably what the user expects.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks, @hadijahkyampeire, and @ibacher I think we should leave it as it is for now. So, just closing the PR.

@hadijahkyampeire hadijahkyampeire added Do not merge yet Hold on to merge for some reasons help wanted Extra attention is needed labels Sep 14, 2021
@suruchee suruchee closed this Sep 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Do not merge yet Hold on to merge for some reasons help wanted Extra attention is needed
Projects
None yet
5 participants