Repository navigation
Description
Problem
When an app switches the provider (or baseUrl) of ecc-client-ga4gh-trs-tools, the list loads the tools of the new provider right away, but with the tool class filter of the old one:
updated()resets the page (currentPage = 1) and callsloadData()andloadToolClasses()in parallel;loadData()sendsfilterParams.toolClass, the name of a tool class that the user picked from the previous provider's classes;toolClassesandtoolClassMapkeep the previous provider's classes untilgetToolClasses()of the new provider answers, so the tool class select still offers (and shows as selected) the old classes.
The new provider's first page is then filtered by a class that it may not have (empty list, or the wrong tools), and the select shows options that the new provider doesn't offer, until the user changes the filter.
#577 fixed the same kind of problem in the TRS-Filer tool form (tool-create), which clears the old tool classes on a switch and keeps submit disabled until the selected class is among the loaded ones.
Proposed fix
In packages/ecc-client-ga4gh-trs/src/components/tools/tools.ts, on a provider switch (the useProvider() branch of updated()):
- Clear
toolClassesandtoolClassMapbefore loading, so the select doesn't offer the old classes. - Either reset
filterParams.toolClassto""(all classes), or keep it only if the new provider's classes contain it: load the tool classes first and then the tools, and drop the filter if the class isn't offered. - Fire
ecc-tools-changedas today, with the tools of the unfiltered (or still valid) query.
The first option is simpler and matches "another provider starts on its first page"; the second keeps a filter that both registries share (e.g. Workflow).
Tests
- Switch the provider while a tool class filter is set: the first request to the new provider has no tool class (or only one that the new provider offers), and the select shows no old classes while the new ones load.
- A slow
getToolClasses()of the new provider doesn't bring back the old classes.
Docs
Note in the TRS tools page (and the providers overview's paragraph on provider switches) that a switch resets the tool class filter.
Follow-up to #577 (note by @anuragxxd); related: #565.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsIn review
Activity