Fix console showing endless loading when logs are empty
All checks were successful
Deploy GSM / deploy (push) Successful in 23s

Changed logs state initialization from empty string to null to properly
distinguish between "not yet loaded" and "loaded but empty" states.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Alexander Zielonka
2026-01-13 10:17:11 +01:00
parent 66716279ad
commit 8af57aa81a
2 changed files with 4 additions and 4 deletions

View File

@@ -10,7 +10,7 @@ export default function ServerDetailModal({ server, onClose, onUpdate }) {
const [activeTab, setActiveTab] = useState('overview')
const [rconCommand, setRconCommand] = useState('')
const [rconHistory, setRconHistory] = useState([])
const [logs, setLogs] = useState('')
const [logs, setLogs] = useState(null)
const logsRef = useRef(null)
const rconRef = useRef(null)
@@ -299,7 +299,7 @@ export default function ServerDetailModal({ server, onClose, onUpdate }) {
ref={logsRef}
className="terminal rounded h-96 overflow-y-auto p-4 font-mono text-xs text-[#00ff41]/80 whitespace-pre-wrap"
>
{logs || 'Loading...'}
{logs === null ? 'Loading...' : (logs || 'Keine Logs verfügbar')}
</div>
</div>
)}

View File

@@ -31,7 +31,7 @@ export default function ServerDetail() {
const [activeTab, setActiveTab] = useState('overview')
const [rconCommand, setRconCommand] = useState('')
const [rconHistory, setRconHistory] = useState([])
const [logs, setLogs] = useState('')
const [logs, setLogs] = useState(null)
const [whitelistPlayers, setWhitelistPlayers] = useState([])
const [whitelistInput, setWhitelistInput] = useState('')
@@ -517,7 +517,7 @@ const formatUptime = (seconds) => {
ref={logsRef}
className="terminal p-4 logs-container text-xs text-neutral-300 whitespace-pre-wrap"
>
{logs || 'Laden...'}
{logs === null ? 'Laden...' : (logs || 'Keine Logs verfügbar')}
</div>
{/* RCON History */}