Skip to content

Commit

Permalink
Small fix for #750. Groups were not filtering the products correctly.
Browse files Browse the repository at this point in the history
  • Loading branch information
Hallbergs committed Nov 9, 2021
1 parent 76854ad commit a425f9f
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions new-client/src/plugins/FmeServer/FmeServerView.js
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,12 @@ const FmeServerView = (props) => {
handleResetDraw();
}, [activeProduct, handleResetDraw]);

// This effect makes sure that we clear the active product when
// the activeGroup changes.
React.useEffect(() => {
setActiveProduct("");
}, [activeGroup]);

// If the user reaches the last step, they will be able to reset
// the stepper. If they do, there will be some cleanup done.
function handleResetStepper() {
Expand Down Expand Up @@ -270,13 +276,13 @@ const FmeServerView = (props) => {
// Let's get the products from the config.
const products = props.options?.products ?? [];
// And get the products that belong to the current group.
products.filter((product) => {
const filteredProducts = products.filter((product) => {
return product.group === activeGroup;
});
// Then we sort the products alphabetically
products.sort((a, b) => a.name.localeCompare(b.name));
filteredProducts.sort((a, b) => a.name.localeCompare(b.name));
// Return the sorted products
return products;
return filteredProducts;
}

// Returns wether it is OK to continue from the step where the
Expand Down

0 comments on commit a425f9f

Please sign in to comment.