mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-03-24 02:11:10 +01:00
fix http response load when filter (#251)
This commit is contained in:
@@ -3,8 +3,8 @@ import type { ReactNode } from 'react';
|
||||
import { useCallback, useMemo } from 'react';
|
||||
import { createGlobalState } from 'react-use';
|
||||
import { useDebouncedValue } from '../../hooks/useDebouncedValue';
|
||||
import { useFilterResponse } from '../../hooks/useFilterResponse';
|
||||
import { useFormatText } from '../../hooks/useFormatText';
|
||||
import { useResponseBodyText } from '../../hooks/useResponseBodyText';
|
||||
import type { EditorProps } from '../core/Editor/Editor';
|
||||
import { Editor } from '../core/Editor/Editor';
|
||||
import { hyperlink } from '../core/Editor/hyperlink/extension';
|
||||
@@ -36,7 +36,7 @@ export function TextViewer({ language, text, responseId, requestId, pretty, clas
|
||||
);
|
||||
|
||||
const isSearching = filterText != null;
|
||||
const filteredResponse = useFilterResponse({ filter: debouncedFilterText ?? '', responseId });
|
||||
const filteredResponse = useResponseBodyText({ responseId, filter: debouncedFilterText ?? null });
|
||||
|
||||
const toggleSearch = useCallback(() => {
|
||||
if (isSearching) {
|
||||
@@ -58,7 +58,7 @@ export function TextViewer({ language, text, responseId, requestId, pretty, clas
|
||||
<div key="input" className="w-full !opacity-100">
|
||||
<Input
|
||||
key={requestId}
|
||||
validate={!(filteredResponse.error || filteredResponse.data?.error)}
|
||||
validate={!filteredResponse.error}
|
||||
hideLabel
|
||||
autoFocus
|
||||
containerClassName="bg-surface"
|
||||
@@ -91,7 +91,6 @@ export function TextViewer({ language, text, responseId, requestId, pretty, clas
|
||||
}, [
|
||||
canFilter,
|
||||
filterText,
|
||||
filteredResponse.data?.error,
|
||||
filteredResponse.error,
|
||||
filteredResponse.isPending,
|
||||
isSearching,
|
||||
@@ -112,7 +111,7 @@ export function TextViewer({ language, text, responseId, requestId, pretty, clas
|
||||
if (filteredResponse.error) {
|
||||
body = '';
|
||||
} else {
|
||||
body = filteredResponse.data?.content != null ? filteredResponse.data.content : '';
|
||||
body = filteredResponse.data != null ? filteredResponse.data : '';
|
||||
}
|
||||
} else {
|
||||
body = formattedBody;
|
||||
|
||||
Reference in New Issue
Block a user