Remove debug logging statements from ApiServerContext and AuthContext to clean up the code and improve performance.

This commit is contained in:
Tom Butcher 2025-07-19 21:35:20 +01:00
parent cd83679232
commit 8dbd87ff4c
2 changed files with 0 additions and 11 deletions

View File

@ -244,8 +244,6 @@ const ApiServerProvider = ({ children }) => {
subscribedCallbacksRef.current.set(id, callbacks) subscribedCallbacksRef.current.set(id, callbacks)
} }
} }
logger.debug('Removed update event listener for object:', id)
} }
}, []) }, [])
@ -263,26 +261,19 @@ const ApiServerProvider = ({ children }) => {
subscribedCallbacksRef.current.set(type, callbacks) subscribedCallbacksRef.current.set(type, callbacks)
} }
} }
logger.debug('Removed new event listener for type:', type)
} }
}, []) }, [])
const subscribeToObject = useCallback( const subscribeToObject = useCallback(
(id, type, callback) => { (id, type, callback) => {
logger.debug('Subscribing to object:', id, 'type:', type)
if (socketRef.current && socketRef.current.connected == true) { if (socketRef.current && socketRef.current.connected == true) {
// Add callback to the subscribed callbacks map immediately // Add callback to the subscribed callbacks map immediately
if (!subscribedCallbacksRef.current.has(id)) { if (!subscribedCallbacksRef.current.has(id)) {
subscribedCallbacksRef.current.set(id, []) subscribedCallbacksRef.current.set(id, [])
} }
subscribedCallbacksRef.current.get(id).push(callback) subscribedCallbacksRef.current.get(id).push(callback)
logger.debug(
`Added callback for object ${id}, total callbacks: ${subscribedCallbacksRef.current.get(id).length}`
)
socketRef.current.emit('subscribe', { id: id, type: type }) socketRef.current.emit('subscribe', { id: id, type: type })
logger.debug('Registered update event listener for object:', id)
// Return cleanup function // Return cleanup function
return () => offUpdateEvent(id, type, callback) return () => offUpdateEvent(id, type, callback)

View File

@ -170,8 +170,6 @@ const AuthProvider = ({ children }) => {
} }
intervalId = setInterval(tokenRefresh, 1000) intervalId = setInterval(tokenRefresh, 1000)
console.log('fresh', authenticated)
tokenRefresh() tokenRefresh()
return () => { return () => {