refactor: Rework kyma modules list#3867
Conversation
src/state/moduleTemplatesAtom.ts
Outdated
| import { useEffect, useState } from 'react'; | ||
| import { clusterState } from './clusterAtom'; | ||
|
|
||
| export async function useGetModuleTemplatesCount() { |
There was a problem hiding this comment.
Custom hook as an asynchronous function may not be a good practice. Is it possible to change it? We can use useEffect to get asynchronous and we can also use asynchronous function inside custom hook.
| setKymaResource, | ||
| props, | ||
| }) { | ||
| export default function KymaModulesAddModule({ props }) { |
There was a problem hiding this comment.
I know this has been done before, but it looks weird to have a props object inside a props object :-) We can change it by using it that way: <KymaModulesAddModule {...renderProps} /> (or list them all) in kymaModules.routes.js and then: KymaModulesAddModule(props).
| handleResourceDelete, | ||
| showDeleteDialog, | ||
| }) => { | ||
| const ColumnWraper = ({ defaultColumn = 'list', namespaced = false }) => { |
There was a problem hiding this comment.
The parameters from useDeleteResource are passed to <ColumnWraper />, but they are not consumed here. I also noticed that the delete box started shaking sometimes again.
| scope: Scope, | ||
| configFeatures: ConfigFeatureList, | ||
| kymaResources: any, | ||
| moduleTemplatesCount: any, |
There was a problem hiding this comment.
Maybe it's better to change this type from any to number | null now?
Description
Changes proposed in this pull request:
Related issue(s)
Definition of done
backlog#4567