mirror of
https://github.com/complexcaresolutions/cms.c2sgmbh.git
synced 2026-03-17 17:24:12 +00:00
fix: resolve all ESLint errors for clean CI pipeline
- Extend admin component overrides to cover all Payload admin views (no-html-link-for-pages, no-img-element off for admin panel) - Rename useGeneratedReply to applyGeneratedReply (not a hook) - Fix useRealtimeUpdates: resolve circular dependency with connectRef, wrap ref assignments in useEffect for React 19 compiler compliance - Fix MetaBaseClient: let -> const for single-assignment variable ESLint now passes with 0 errors (68 warnings only). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
55189aaa1a
commit
d94db78aec
4 changed files with 34 additions and 23 deletions
|
|
@ -25,10 +25,11 @@ const eslintConfig = [
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
// Payload Admin components can use <a> elements (they're not in Next.js page router)
|
// Payload Admin components can use <a> and <img> elements (they're not in Next.js page router)
|
||||||
files: ['src/components/admin/**/*.tsx'],
|
files: ['src/components/admin/**/*.tsx', 'src/app/(payload)/admin/**/*.tsx'],
|
||||||
rules: {
|
rules: {
|
||||||
'@next/next/no-html-link-for-pages': 'off',
|
'@next/next/no-html-link-for-pages': 'off',
|
||||||
|
'@next/next/no-img-element': 'off',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -469,7 +469,7 @@ export const CommunityInbox: React.FC = () => {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Use generated reply
|
// Use generated reply
|
||||||
const useGeneratedReply = (reply: { text: string }) => {
|
const applyGeneratedReply = (reply: { text: string }) => {
|
||||||
setReplyText(reply.text)
|
setReplyText(reply.text)
|
||||||
setGeneratedReplies([])
|
setGeneratedReplies([])
|
||||||
}
|
}
|
||||||
|
|
@ -1518,7 +1518,7 @@ export const CommunityInbox: React.FC = () => {
|
||||||
)}
|
)}
|
||||||
<button
|
<button
|
||||||
className="btn btn-use-suggestion"
|
className="btn btn-use-suggestion"
|
||||||
onClick={() => useGeneratedReply(reply)}
|
onClick={() => applyGeneratedReply(reply)}
|
||||||
>
|
>
|
||||||
Übernehmen
|
Übernehmen
|
||||||
</button>
|
</button>
|
||||||
|
|
|
||||||
|
|
@ -94,12 +94,29 @@ export function useRealtimeUpdates(
|
||||||
const eventSourceRef = useRef<EventSource | null>(null)
|
const eventSourceRef = useRef<EventSource | null>(null)
|
||||||
const reconnectTimeoutRef = useRef<NodeJS.Timeout | null>(null)
|
const reconnectTimeoutRef = useRef<NodeJS.Timeout | null>(null)
|
||||||
const lastTimestampRef = useRef<string | null>(null)
|
const lastTimestampRef = useRef<string | null>(null)
|
||||||
|
const connectRef = useRef<() => void>(() => {})
|
||||||
|
|
||||||
// Callbacks als Refs speichern um Dependency-Probleme zu vermeiden
|
// Callbacks als Refs speichern um Dependency-Probleme zu vermeiden
|
||||||
const onUpdateRef = useRef(onUpdate)
|
const onUpdateRef = useRef(onUpdate)
|
||||||
const onConnectionChangeRef = useRef(onConnectionChange)
|
const onConnectionChangeRef = useRef(onConnectionChange)
|
||||||
|
useEffect(() => {
|
||||||
onUpdateRef.current = onUpdate
|
onUpdateRef.current = onUpdate
|
||||||
onConnectionChangeRef.current = onConnectionChange
|
onConnectionChangeRef.current = onConnectionChange
|
||||||
|
})
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reconnect nach Verzögerung planen
|
||||||
|
*/
|
||||||
|
const scheduleReconnect = useCallback(() => {
|
||||||
|
if (reconnectTimeoutRef.current) {
|
||||||
|
return // Bereits geplant
|
||||||
|
}
|
||||||
|
|
||||||
|
reconnectTimeoutRef.current = setTimeout(() => {
|
||||||
|
reconnectTimeoutRef.current = null
|
||||||
|
connectRef.current()
|
||||||
|
}, 3000) // 3 Sekunden warten
|
||||||
|
}, [])
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Verbindung herstellen
|
* Verbindung herstellen
|
||||||
|
|
@ -205,7 +222,12 @@ export function useRealtimeUpdates(
|
||||||
setConnecting(false)
|
setConnecting(false)
|
||||||
setError('Failed to connect')
|
setError('Failed to connect')
|
||||||
}
|
}
|
||||||
}, [channelIds, connecting, maxUpdates])
|
}, [channelIds, connecting, maxUpdates, scheduleReconnect])
|
||||||
|
|
||||||
|
// Keep ref in sync so scheduleReconnect can call latest connect
|
||||||
|
useEffect(() => {
|
||||||
|
connectRef.current = connect
|
||||||
|
})
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Verbindung trennen
|
* Verbindung trennen
|
||||||
|
|
@ -226,20 +248,6 @@ export function useRealtimeUpdates(
|
||||||
onConnectionChangeRef.current?.(false)
|
onConnectionChangeRef.current?.(false)
|
||||||
}, [])
|
}, [])
|
||||||
|
|
||||||
/**
|
|
||||||
* Reconnect nach Verzögerung planen
|
|
||||||
*/
|
|
||||||
const scheduleReconnect = useCallback(() => {
|
|
||||||
if (reconnectTimeoutRef.current) {
|
|
||||||
return // Bereits geplant
|
|
||||||
}
|
|
||||||
|
|
||||||
reconnectTimeoutRef.current = setTimeout(() => {
|
|
||||||
reconnectTimeoutRef.current = null
|
|
||||||
connect()
|
|
||||||
}, 3000) // 3 Sekunden warten
|
|
||||||
}, [connect])
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Updates zurücksetzen
|
* Updates zurücksetzen
|
||||||
*/
|
*/
|
||||||
|
|
@ -254,9 +262,10 @@ export function useRealtimeUpdates(
|
||||||
setNewCount(0)
|
setNewCount(0)
|
||||||
}, [])
|
}, [])
|
||||||
|
|
||||||
// Auto-Connect beim Mount
|
// Auto-Connect beim Mount (SSE external system subscription)
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (autoConnect) {
|
if (autoConnect) {
|
||||||
|
// eslint-disable-next-line react-hooks/set-state-in-effect -- SSE subscription pattern
|
||||||
connect()
|
connect()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -268,6 +277,7 @@ export function useRealtimeUpdates(
|
||||||
// Channel-IDs Änderung: Reconnect
|
// Channel-IDs Änderung: Reconnect
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (connected || connecting) {
|
if (connected || connecting) {
|
||||||
|
// eslint-disable-next-line react-hooks/set-state-in-effect -- SSE reconnect pattern
|
||||||
disconnect()
|
disconnect()
|
||||||
// Kurz warten, dann neu verbinden
|
// Kurz warten, dann neu verbinden
|
||||||
const timeout = setTimeout(() => {
|
const timeout = setTimeout(() => {
|
||||||
|
|
|
||||||
|
|
@ -133,7 +133,7 @@ export class MetaBaseClient {
|
||||||
|
|
||||||
// Initial request
|
// Initial request
|
||||||
const initialParams = { ...params, limit }
|
const initialParams = { ...params, limit }
|
||||||
let response = await this.request<MetaPaginatedResponse<T>>(endpoint, {
|
const response = await this.request<MetaPaginatedResponse<T>>(endpoint, {
|
||||||
params: initialParams,
|
params: initialParams,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue