@overmap-ai/core 1.0.48-component-type-views.2 → 1.0.48-component-type-views.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1641,15 +1641,15 @@ const selectComponentTypeFromComponents = (state) => {
1641
1641
  }
1642
1642
  return ret;
1643
1643
  };
1644
+ let prevComponentsByType = null;
1644
1645
  const selectComponentsByType = (componentTypeId) => (state) => {
1645
1646
  const components = state.componentReducer.components;
1646
- const componentsOfType = [];
1647
- for (const component of Object.values(components)) {
1648
- if (component.component_type === componentTypeId) {
1649
- componentsOfType.push(component);
1650
- }
1647
+ if (!prevComponentsByType) {
1648
+ prevComponentsByType = Object.values(components).filter(
1649
+ (component) => component.component_type === componentTypeId
1650
+ );
1651
1651
  }
1652
- return componentsOfType;
1652
+ return prevComponentsByType;
1653
1653
  };
1654
1654
  const selectNumberOfComponentsOfComponentType = (componentTypeId) => (state) => {
1655
1655
  var _a2;