mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-01-18 23:16:59 +01:00
Fix lint errors
This commit is contained in:
@@ -176,7 +176,6 @@ export function GrpcRequestPane({
|
||||
<UrlBar
|
||||
key={forceUpdateKey}
|
||||
url={activeRequest.url ?? ''}
|
||||
method={null}
|
||||
submitIcon={null}
|
||||
forceUpdateKey={forceUpdateKey}
|
||||
placeholder="localhost:50051"
|
||||
|
||||
@@ -41,7 +41,8 @@ import type { GenericCompletionConfig } from './core/Editor/genericCompletion';
|
||||
import { InlineCode } from './core/InlineCode';
|
||||
import type { Pair } from './core/PairEditor';
|
||||
import { PlainInput } from './core/PlainInput';
|
||||
import { TabContent, TabItem, Tabs } from './core/Tabs/Tabs';
|
||||
import { TabContent, Tabs } from './core/Tabs/Tabs';
|
||||
import type { TabItem } from './core/Tabs/Tabs';
|
||||
import { EmptyStateText } from './EmptyStateText';
|
||||
import { FormMultipartEditor } from './FormMultipartEditor';
|
||||
import { FormUrlencodedEditor } from './FormUrlencodedEditor';
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { HttpRequest, patchModel } from '@yaakapp-internal/models';
|
||||
import type { HttpRequest } from '@yaakapp-internal/models';
|
||||
import { patchModel } from '@yaakapp-internal/models';
|
||||
import classNames from 'classnames';
|
||||
import { memo, useCallback, useMemo } from 'react';
|
||||
import { showPrompt } from '../lib/prompt';
|
||||
@@ -32,9 +33,12 @@ export const RequestMethodDropdown = memo(function RequestMethodDropdown({
|
||||
request,
|
||||
className,
|
||||
}: Props) {
|
||||
const handleChange = useCallback(async (method: string) => {
|
||||
await patchModel(request, { method });
|
||||
}, []);
|
||||
const handleChange = useCallback(
|
||||
async (method: string) => {
|
||||
await patchModel(request, { method });
|
||||
},
|
||||
[request],
|
||||
);
|
||||
|
||||
const itemsAfter = useMemo<DropdownItem[]>(
|
||||
() => [
|
||||
@@ -57,7 +61,7 @@ export const RequestMethodDropdown = memo(function RequestMethodDropdown({
|
||||
},
|
||||
},
|
||||
],
|
||||
[],
|
||||
[handleChange],
|
||||
);
|
||||
|
||||
return (
|
||||
@@ -68,7 +72,7 @@ export const RequestMethodDropdown = memo(function RequestMethodDropdown({
|
||||
onChange={handleChange}
|
||||
>
|
||||
<Button size="xs" className={classNames(className, 'text-text-subtle hover:text')}>
|
||||
<HttpMethodTag request={request}/>
|
||||
<HttpMethodTag request={request} />
|
||||
</Button>
|
||||
</RadioDropdown>
|
||||
);
|
||||
|
||||
@@ -54,10 +54,9 @@ const TAB_DESCRIPTION = 'description';
|
||||
const nonActiveRequestUrlsAtom = atom((get) => {
|
||||
const activeRequestId = get(activeRequestIdAtom);
|
||||
const requests = get(allRequestsAtom);
|
||||
const urls = requests
|
||||
return requests
|
||||
.filter((r) => r.id !== activeRequestId)
|
||||
.map((r): GenericCompletionOption => ({ type: 'constant', label: r.url }));
|
||||
return urls;
|
||||
});
|
||||
|
||||
const memoNotActiveRequestUrlsAtom = deepEqualAtom(nonActiveRequestUrlsAtom);
|
||||
@@ -227,7 +226,6 @@ export function WebsocketRequestPane({ style, fullHeight, className, activeReque
|
||||
onUrlChange={handleUrlChange}
|
||||
forceUpdateKey={forceUpdateKey}
|
||||
isLoading={activeResponse != null && activeResponse.state !== 'closed'}
|
||||
method={null}
|
||||
/>
|
||||
</div>
|
||||
<Tabs
|
||||
|
||||
@@ -55,10 +55,9 @@ export function WebsocketResponsePane({ activeRequest }: Props) {
|
||||
if (hexDump) {
|
||||
return activeEvent?.message ? hexy(activeEvent?.message) : '';
|
||||
}
|
||||
const text = activeEvent?.message
|
||||
return activeEvent?.message
|
||||
? new TextDecoder('utf-8').decode(Uint8Array.from(activeEvent.message))
|
||||
: '';
|
||||
return text;
|
||||
}, [activeEvent?.message, hexDump]);
|
||||
|
||||
const language = languageFromContentType(null, message);
|
||||
@@ -152,7 +151,7 @@ export function WebsocketResponsePane({ activeRequest }: Props) {
|
||||
title="Copy message"
|
||||
icon="copy"
|
||||
size="xs"
|
||||
onClick={() => copyToClipboard(formattedMessage.data ?? '')}
|
||||
onClick={() => copyToClipboard(formattedMessage ?? '')}
|
||||
/>
|
||||
</HStack>
|
||||
)}
|
||||
@@ -183,7 +182,7 @@ export function WebsocketResponsePane({ activeRequest }: Props) {
|
||||
) : (
|
||||
<Editor
|
||||
language={language}
|
||||
defaultValue={formattedMessage.data ?? ''}
|
||||
defaultValue={formattedMessage ?? ''}
|
||||
wrapLines={false}
|
||||
readOnly={true}
|
||||
stateKey={null}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { GrpcRequest, HttpRequest, settingsAtom, WebsocketRequest } from '@yaakapp-internal/models';
|
||||
import { settingsAtom } from '@yaakapp-internal/models';
|
||||
import type { GrpcRequest, HttpRequest, WebsocketRequest } from '@yaakapp-internal/models';
|
||||
import classNames from 'classnames';
|
||||
import { useAtomValue } from 'jotai';
|
||||
|
||||
|
||||
@@ -125,8 +125,8 @@ function ActualEventStreamViewer({ response }: Props) {
|
||||
|
||||
function FormattedEditor({ text, language }: { text: string; language: EditorProps['language'] }) {
|
||||
const formatted = useFormatText({ text, language, pretty: true });
|
||||
if (formatted.data == null) return null;
|
||||
return <Editor readOnly defaultValue={formatted.data} language={language} stateKey={null} />;
|
||||
if (formatted == null) return null;
|
||||
return <Editor readOnly defaultValue={formatted} language={language} stateKey={null} />;
|
||||
}
|
||||
|
||||
function EventRow({
|
||||
|
||||
Reference in New Issue
Block a user