fix(app): kein 404 bei Dateien/Desktop im Hauptchat (leere project_id)
Im Hauptchat (projectId='') riefen FilesTile/DesktopTile /projects//files bzw. /vms auf → Brain 404. Beide guarden jetzt leere projectId: kein Fetch, klare Meldung "Kein aktives Projekt — wechsle in ein Projekt". tsc clean. App-only, Deploy: APK. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -26,6 +26,7 @@ const DesktopTile: React.FC<Props> = ({ projectId, focused }) => {
|
|||||||
const [shot, setShot] = useState<{ name: string; b64: string } | null>(null);
|
const [shot, setShot] = useState<{ name: string; b64: string } | null>(null);
|
||||||
|
|
||||||
const load = useCallback(() => {
|
const load = useCallback(() => {
|
||||||
|
if (!projectId) { setVms([]); setErr(''); setLoading(false); return; }
|
||||||
setLoading(true); setErr('');
|
setLoading(true); setErr('');
|
||||||
brainApi.listProjectVms(projectId)
|
brainApi.listProjectVms(projectId)
|
||||||
.then(r => setVms(r.vms || []))
|
.then(r => setVms(r.vms || []))
|
||||||
@@ -82,6 +83,8 @@ const DesktopTile: React.FC<Props> = ({ projectId, focused }) => {
|
|||||||
<ActivityIndicator color="#0096FF" style={{ marginTop: 20 }} />
|
<ActivityIndicator color="#0096FF" style={{ marginTop: 20 }} />
|
||||||
) : err ? (
|
) : err ? (
|
||||||
<Text style={styles.err}>{err}</Text>
|
<Text style={styles.err}>{err}</Text>
|
||||||
|
) : !projectId ? (
|
||||||
|
<Text style={styles.empty}>Kein aktives Projekt — wechsle in ein Projekt für dessen VMs.</Text>
|
||||||
) : vms.length === 0 ? (
|
) : vms.length === 0 ? (
|
||||||
<Text style={styles.empty}>
|
<Text style={styles.empty}>
|
||||||
Noch keine VM in diesem Projekt.{'\n'}
|
Noch keine VM in diesem Projekt.{'\n'}
|
||||||
|
|||||||
@@ -43,6 +43,7 @@ const FilesTile: React.FC<Props> = ({ projectId, focused }) => {
|
|||||||
const [previewBusy, setPreviewBusy] = useState('');
|
const [previewBusy, setPreviewBusy] = useState('');
|
||||||
|
|
||||||
const load = useCallback(() => {
|
const load = useCallback(() => {
|
||||||
|
if (!projectId) { setFiles([]); setErr(''); setLoading(false); return; }
|
||||||
setLoading(true); setErr('');
|
setLoading(true); setErr('');
|
||||||
brainApi.listProjectFiles(projectId)
|
brainApi.listProjectFiles(projectId)
|
||||||
.then(r => setFiles((r.files || []).slice().sort((a, b) => a.path.localeCompare(b.path))))
|
.then(r => setFiles((r.files || []).slice().sort((a, b) => a.path.localeCompare(b.path))))
|
||||||
@@ -88,7 +89,7 @@ const FilesTile: React.FC<Props> = ({ projectId, focused }) => {
|
|||||||
) : err ? (
|
) : err ? (
|
||||||
<Text style={styles.err}>{err}</Text>
|
<Text style={styles.err}>{err}</Text>
|
||||||
) : files.length === 0 ? (
|
) : files.length === 0 ? (
|
||||||
<Text style={styles.empty}>Noch keine Dateien in diesem Projekt.</Text>
|
<Text style={styles.empty}>{!projectId ? 'Kein aktives Projekt — wechsle in ein Projekt für dessen Dateien.' : 'Noch keine Dateien in diesem Projekt.'}</Text>
|
||||||
) : (
|
) : (
|
||||||
files.map(f => (
|
files.map(f => (
|
||||||
<TouchableOpacity key={f.path} onPress={() => open(f)} style={styles.row} disabled={previewBusy === f.path}>
|
<TouchableOpacity key={f.path} onPress={() => open(f)} style={styles.row} disabled={previewBusy === f.path}>
|
||||||
|
|||||||
Reference in New Issue
Block a user