Clean up model fetching and loading states

This commit is contained in:
Gregory Schier
2025-01-20 13:44:11 -08:00
parent 0453e84d38
commit 8ad7ac0bef
42 changed files with 180 additions and 247 deletions

View File

@@ -16,7 +16,7 @@ export function BinaryViewer({ response }: Props) {
const contentType = getContentTypeHeader(response.headers) ?? 'unknown';
// Wait until the response has been fully-downloaded
if (response.state !== 'closed') {
if (response.state === 'closed') {
return (
<EmptyStateText>
<Icon icon="refresh" spin />

View File

@@ -19,10 +19,11 @@ export function HTMLOrTextViewer({ response, pretty, textViewerClassName }: Prop
rawTextBody.data ?? '',
);
if (rawTextBody.isLoading) {
if (rawTextBody.isLoading || response.state === 'initialized') {
return null;
}
console.log("HELLO", rawTextBody.data, response);
// Wasn't able to decode as text, so it must be binary
if (rawTextBody.data == null) {
return <BinaryViewer response={response} />;