Skip to content

Commit

Permalink
fix no modules selected
Browse files Browse the repository at this point in the history
  • Loading branch information
OliwiaGowor committed Jul 3, 2024
1 parent 91d58e6 commit 0d51fc3
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/components/KymaModules/KymaModulesAddModule.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@ export default function KymaModulesAddModule(props) {
cloneDeep(initialKymaResource),
);
const [selectedModules, setSelectedModules] = useState(
initialKymaResource?.spec?.modules,
initialKymaResource?.spec?.modules ?? [],
);

console.log(initialKymaResource?.spec?.modules);
const [columnsCount, setColumnsCount] = useState(2);
const cardsContainerRef = useRef(null);

Expand All @@ -71,7 +71,7 @@ export default function KymaModulesAddModule(props) {
useEffect(() => {
setInitialUnchangedResource(cloneDeep(initialKymaResource));
setKymaResource(cloneDeep(initialKymaResource));
setSelectedModules(initialKymaResource?.spec?.modules);
setSelectedModules(initialKymaResource?.spec?.modules ?? []);
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [loading]);

Expand Down Expand Up @@ -126,7 +126,7 @@ export default function KymaModulesAddModule(props) {
module.metadata.labels['operator.kyma-project.io/beta'] === 'true',
});
} else {
existingModule.channels.push({
existingModule.channels?.push({
channel: module.spec.channel,
version: module.spec.descriptor.component.version,
});
Expand Down

0 comments on commit 0d51fc3

Please sign in to comment.