File tree Expand file tree Collapse file tree 5 files changed +19
-23
lines changed
MonacoEditorESM/autocompletion
tests/integration/fixtures Expand file tree Collapse file tree 5 files changed +19
-23
lines changed Original file line number Diff line number Diff line change @@ -38,7 +38,6 @@ export default defineConfig(
3838 'react-hooks/set-state-in-effect' : 'warn' ,
3939 'react-hooks/preserve-manual-memoization' : 'warn' ,
4040 'react-hooks/immutability' : 'warn' ,
41- 'react-hooks/purity' : 'warn' ,
4241 'react-hooks/use-memo' : 'warn' ,
4342
4443 // TypeScript
Original file line number Diff line number Diff line change @@ -2,10 +2,11 @@ import { useTranslation } from 'react-i18next';
22import { FormattedDatetime } from 'shared/components/FormattedDate/FormattedDate' ;
33import { Tooltip } from 'shared/components/Tooltip/Tooltip' ;
44import { Icon } from '@ui5/webcomponents-react' ;
5+ import useDateNow from 'shared/hooks/dateNow' ;
56
67export function CertificateDate ( { date, lang } ) {
78 const { t } = useTranslation ( ) ;
8- const currentDate = Date . now ( ) ;
9+ const currentDate = useDateNow ( 10_000 ) ;
910 const dayInMilliseconds = 1000 * 60 * 60 * 24 ;
1011 const dateDifference = ( Date . parse ( date ) - currentDate ) / dayInMilliseconds ;
1112 const EXPIRATION_LIMIT = 30 ;
Original file line number Diff line number Diff line change 11import { useCallback , useState } from 'react' ;
2- import { Uri } from 'monaco-editor' ;
32import * as monaco from 'monaco-editor' ;
3+ import { Uri } from 'monaco-editor' ;
44import { configureMonacoYaml } from 'monaco-yaml' ;
55import { useGetSchema } from 'hooks/useGetSchema' ;
66import YamlWorker from './yaml.worker.js?worker' ;
@@ -33,7 +33,8 @@ export function useAutocompleteWorker({
3333 readOnly,
3434 schema : predefinedSchema ,
3535} ) {
36- const [ schemaId ] = useState ( predefinedSchemaId || Math . random ( ) . toString ( ) ) ;
36+ const [ randomID ] = useState ( ( ) => Math . random ( ) . toString ( ) ) ;
37+ const [ schemaId ] = useState ( predefinedSchemaId || randomID ) ;
3738 // Use schemaId for URI to ensure same resource types share the same schema URI
3839 const schemaUri = `file://kubernetes.io/${ schemaId } ` ;
3940
Original file line number Diff line number Diff line change 1+ import { useEffect , useState } from 'react' ;
2+
3+ export default function useDateNow ( refreshInterval : number = 1_000 ) {
4+ const [ time , setTime ] = useState ( ( ) => Date . now ( ) ) ;
5+ useEffect ( ( ) => {
6+ const handler = ( ) => {
7+ const timeNow = Date . now ( ) ;
8+ setTime ( timeNow ) ;
9+ } ;
10+ const interval = setInterval ( handler , refreshInterval ) ;
11+ return ( ) => clearInterval ( interval ) ;
12+ } ) ;
13+ return time ;
14+ }
Original file line number Diff line number Diff line change @@ -460,22 +460,3 @@ spec:
460460 jsonPath : .metadata.creationTimestamp
461461 conversion :
462462 strategy : None
463- status :
464- conditions :
465- - type : NamesAccepted
466- status : ' True'
467- lastTransitionTime : ' 2025-02-28T11:14:56Z'
468- reason : NoConflicts
469- message : no conflicts found
470- - type : Established
471- status : ' True'
472- lastTransitionTime : ' 2025-02-28T11:14:56Z'
473- reason : InitialNamesAccepted
474- message : the initial names have been accepted
475- acceptedNames :
476- plural : moduletemplates
477- singular : moduletemplate
478- kind : ModuleTemplate
479- listKind : ModuleTemplateList
480- storedVersions :
481- - v1beta2
You can’t perform that action at this time.
0 commit comments