mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-03-21 17:09:09 +01:00
More eslint fixes
This commit is contained in:
@@ -22,7 +22,7 @@ interface GraphQLBody {
|
||||
|
||||
export function GraphQLEditor({ defaultValue, onChange, baseRequest, ...extraEditorProps }: Props) {
|
||||
const { query, variables } = useMemo<GraphQLBody>(() => {
|
||||
if (!defaultValue) {
|
||||
if (defaultValue === undefined) {
|
||||
return { query: '', variables: {} };
|
||||
}
|
||||
try {
|
||||
@@ -61,6 +61,11 @@ export function GraphQLEditor({ defaultValue, onChange, baseRequest, ...extraEdi
|
||||
|
||||
// Refetch the schema when the URL changes
|
||||
useEffect(() => {
|
||||
// First, clear the schema
|
||||
if (editorViewRef.current) {
|
||||
updateSchema(editorViewRef.current, undefined);
|
||||
}
|
||||
|
||||
let unmounted = false;
|
||||
const body = JSON.stringify({
|
||||
query: getIntrospectionQuery(),
|
||||
@@ -76,14 +81,15 @@ export function GraphQLEditor({ defaultValue, onChange, baseRequest, ...extraEdi
|
||||
updateSchema(editorViewRef.current, schema);
|
||||
} catch (err) {
|
||||
console.log('Failed to parse introspection query', err);
|
||||
updateSchema(editorViewRef.current, undefined);
|
||||
return;
|
||||
}
|
||||
});
|
||||
|
||||
return () => {
|
||||
unmounted = true;
|
||||
};
|
||||
}, [baseRequest, baseRequest.url]);
|
||||
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [baseRequest.url]);
|
||||
|
||||
return (
|
||||
<div className="pb-2 h-full grid grid-rows-[minmax(0,100%)_auto_auto_minmax(0,auto)]">
|
||||
|
||||
@@ -25,7 +25,7 @@ export const HStack = forwardRef(function HStack(
|
||||
return (
|
||||
<BaseStack
|
||||
ref={ref}
|
||||
className={classnames(className, 'flex-row', space && gapClasses[space])}
|
||||
className={classnames(className, 'flex-row', space != null && gapClasses[space])}
|
||||
{...props}
|
||||
>
|
||||
{children}
|
||||
@@ -45,7 +45,7 @@ export const VStack = forwardRef(function VStack(
|
||||
return (
|
||||
<BaseStack
|
||||
ref={ref}
|
||||
className={classnames(className, 'flex-col', space && gapClasses[space])}
|
||||
className={classnames(className, 'flex-col', space != null && gapClasses[space])}
|
||||
{...props}
|
||||
>
|
||||
{children}
|
||||
|
||||
@@ -6,11 +6,11 @@ export function useDeleteResponses(requestId?: string) {
|
||||
const queryClient = useQueryClient();
|
||||
return useMutation({
|
||||
mutationFn: async () => {
|
||||
if (!requestId) return;
|
||||
if (requestId === undefined) return;
|
||||
await invoke('delete_all_responses', { requestId });
|
||||
},
|
||||
onSuccess: async () => {
|
||||
if (!requestId) return;
|
||||
if (requestId === undefined) return;
|
||||
queryClient.setQueryData(responsesQueryKey({ requestId }), []);
|
||||
},
|
||||
});
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { StrictMode } from 'react';
|
||||
import ReactDOM from 'react-dom/client';
|
||||
import { createRoot } from 'react-dom/client';
|
||||
import { App } from './components/App';
|
||||
import { getKeyValue } from './lib/keyValueStore';
|
||||
import { syncLastLocation } from './lib/lastLocation';
|
||||
@@ -10,7 +10,7 @@ setAppearance(await getKeyValue({ key: 'appearance', fallback: getPreferredAppea
|
||||
await syncLastLocation();
|
||||
|
||||
// root holds our app's root DOM Element:
|
||||
ReactDOM.createRoot(document.getElementById('root') as HTMLElement).render(
|
||||
createRoot(document.getElementById('root') as HTMLElement).render(
|
||||
<StrictMode>
|
||||
<App />
|
||||
</StrictMode>,
|
||||
|
||||
Reference in New Issue
Block a user