File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed
Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change 11import { Button } from '@ui5/webcomponents-react' ;
2- import { FC , useState } from 'react' ;
2+ import { FC , useMemo , useState } from 'react' ;
33import styles from './YamlViewer.module.css' ;
44import { useTranslation } from 'react-i18next' ;
55import YamlViewer from './YamlViewer.tsx' ;
@@ -19,14 +19,17 @@ export const YamlViewButton: FC<YamlViewButtonProps> = ({ resourceObject }) => {
1919 const [ isOpen , setIsOpen ] = useState ( false ) ;
2020 const { t } = useTranslation ( ) ;
2121 const resource = resourceObject as Resource ;
22+ const yamlString = useMemo ( ( ) => {
23+ return stringify ( removeManagedFieldsProperty ( resource ) ) ;
24+ } , [ resource ] ) ;
2225 return (
2326 < span >
2427 < YamlViewDialog
2528 isOpen = { isOpen }
2629 setIsOpen = { setIsOpen }
2730 dialogContent = {
2831 < YamlViewer
29- yamlString = { stringify ( removeManagedFieldsProperty ( resource ) ) }
32+ yamlString = { yamlString }
3033 filename = { `${ resource ?. kind ?? '' } ${ resource ?. metadata ?. name ? '_' : '' } ${ resource ?. metadata ?. name ?? '' } ` }
3134 />
3235 }
You can’t perform that action at this time.
0 commit comments