Migrate to Vite+ unified toolchain (#428)

This commit is contained in:
Gregory Schier
2026-03-13 09:27:56 -07:00
committed by GitHub
parent aed7bd12ea
commit 45262edfbd
166 changed files with 1762 additions and 1519 deletions

View File

@@ -37,7 +37,7 @@ export function useEnsureActiveCookieJar() {
// things change when switching workspaces, and we don't currently have a good way to ensure that all
// stores have updated.
// TODO: Create a global data store that can handle this case
// biome-ignore lint/correctness/useExhaustiveDependencies: none
// oxlint-disable-next-line react-hooks/exhaustive-deps
useEffect(() => {
if (cookieJars == null) return; // Hasn't loaded yet

View File

@@ -16,7 +16,7 @@ interface TypeMap {
}
export function useActiveRequest<T extends keyof TypeMap>(
model?: T | undefined,
model?: T,
): TypeMap[T] | null {
const activeRequest = useAtomValue(activeRequestAtom);
if (model == null) return activeRequest as TypeMap[T];

View File

@@ -18,7 +18,7 @@ export function useCreateDropdownItems({
}: {
hideFolder?: boolean;
hideIcons?: boolean;
folderId?: string | null | 'active-folder';
folderId?: string | null;
} = {}): DropdownItem[] {
const workspaceId = useAtomValue(activeWorkspaceIdAtom);
const activeRequest = useAtomValue(activeRequestAtom);
@@ -40,7 +40,7 @@ export function getCreateDropdownItems({
}: {
hideFolder?: boolean;
hideIcons?: boolean;
folderId?: string | null | 'active-folder';
folderId?: string | null;
workspaceId: string | null;
activeRequest: HttpRequest | GrpcRequest | WebsocketRequest | null;
onCreate?: (

View File

@@ -42,7 +42,7 @@ export function createFastMutation<TData = unknown, TError = unknown, TVariables
if (!disableToastError) {
showToast({
id: stringKey,
message: `${err}`,
message: err instanceof Error ? err.message : String(err),
color: 'danger',
timeout: 5000,
});
@@ -71,6 +71,6 @@ export function useFastMutation<TData = unknown, TError = unknown, TVariables =
) {
return useMemo(() => {
return createFastMutation(defaultArgs);
// biome-ignore lint/correctness/useExhaustiveDependencies: Force it!
// oxlint-disable-next-line react-hooks/exhaustive-deps -- Force it!
}, defaultArgs.mutationKey);
}

View File

@@ -21,7 +21,7 @@ export function useFolderActions() {
queryFn: () => getFolderActions(),
});
// biome-ignore lint/correctness/useExhaustiveDependencies: none
// oxlint-disable-next-line react-hooks/exhaustive-deps
const actions = useMemo(() => {
return actionsResult.data ?? [];
}, [JSON.stringify(actionsResult.data)]);

View File

@@ -24,7 +24,7 @@ export function useGrpcRequestActions() {
},
});
// biome-ignore lint/correctness/useExhaustiveDependencies: none
// oxlint-disable-next-line react-hooks/exhaustive-deps
const actions = useMemo(() => {
return actionsResult.data ?? [];
}, [JSON.stringify(actionsResult.data)]);

View File

@@ -21,7 +21,7 @@ export function useHttpRequestActions() {
queryFn: () => getHttpRequestActions(),
});
// biome-ignore lint/correctness/useExhaustiveDependencies: none
// oxlint-disable-next-line react-hooks/exhaustive-deps
const actions = useMemo(() => {
return actionsResult.data ?? [];
}, [JSON.stringify(actionsResult.data)]);

View File

@@ -7,6 +7,7 @@ import {
} from '@yaakapp-internal/models';
import { useAtomValue } from 'jotai';
import { useEffect } from 'react';
import { fireAndForget } from '../lib/fireAndForget';
export function useHttpResponseEvents(response: HttpResponse | null) {
const allEvents = useAtomValue(httpResponseEventsAtom);
@@ -18,10 +19,10 @@ export function useHttpResponseEvents(response: HttpResponse | null) {
}
// Fetch events from database, filtering out events from other responses and merging atomically
invoke<HttpResponseEvent[]>('cmd_get_http_response_events', { responseId: response.id }).then(
fireAndForget(invoke<HttpResponseEvent[]>('cmd_get_http_response_events', { responseId: response.id }).then(
(events) =>
mergeModelsInStore('http_response_event', events, (e) => e.responseId === response.id),
);
));
}, [response?.id]);
const events = allEvents.filter((e) => e.responseId === response?.id);

View File

@@ -86,7 +86,7 @@ export function useIntrospectGraphQL(
}
}, [activeEnvironment?.id, baseRequest, upsertIntrospection]);
// biome-ignore lint/correctness/useExhaustiveDependencies: none
// oxlint-disable-next-line react-hooks/exhaustive-deps
useEffect(() => {
// Skip introspection if automatic is disabled and we already have one
if (options.disabled) {
@@ -144,14 +144,14 @@ function tryParseIntrospectionToSchema(
let parsedResponse: IntrospectionQuery;
try {
parsedResponse = JSON.parse(content).data;
// biome-ignore lint/suspicious/noExplicitAny: none
// oxlint-disable-next-line no-explicit-any
} catch (e: any) {
return { error: String('message' in e ? e.message : e) };
}
try {
return { schema: buildClientSchema(parsedResponse, {}) };
// biome-ignore lint/suspicious/noExplicitAny: none
// oxlint-disable-next-line no-explicit-any
} catch (e: any) {
return { error: String('message' in e ? e.message : e) };
}

View File

@@ -19,7 +19,7 @@ export function useKeyValue<T extends object | boolean | number | string | null>
fallback: T;
}) {
const { value, isLoading } = useAtomValue(
// biome-ignore lint/correctness/useExhaustiveDependencies: Only create a new atom when the key changes. Fallback might not be a stable reference, so we don't want to refresh on that.
// oxlint-disable-next-line react-hooks/exhaustive-deps -- Only create a new atom when the key changes. Fallback might not be a stable reference, so we don't want to refresh on that.
useMemo(
() =>
selectAtom(
@@ -42,7 +42,7 @@ export function useKeyValue<T extends object | boolean | number | string | null>
mutationFn: (value) => setKeyValue<T>({ namespace, key, value }),
});
// biome-ignore lint/correctness/useExhaustiveDependencies: none
// oxlint-disable-next-line react-hooks/exhaustive-deps
const set = useCallback(
async (valueOrUpdate: ((v: T) => T) | T) => {
if (typeof valueOrUpdate === 'function') {

View File

@@ -5,7 +5,7 @@ export function useKeyboardEvent(
key: KeyboardEvent['key'],
cb: () => void,
) {
// biome-ignore lint/correctness/useExhaustiveDependencies: Don't have `cb` as a dep for caller convenience
// oxlint-disable-next-line react-hooks/exhaustive-deps -- Don't have `cb` as a dep for caller convenience
useEffect(() => {
const fn = (e: KeyboardEvent) => {
if (e.key === key) cb();

View File

@@ -8,6 +8,7 @@ import {
} from '@yaakapp-internal/models';
import { atom, useAtomValue } from 'jotai';
import { useEffect, useMemo } from 'react';
import { fireAndForget } from '../lib/fireAndForget';
import { atomWithKVStorage } from '../lib/atoms/atomWithKVStorage';
import { activeRequestIdAtom } from './useActiveRequestId';
@@ -69,9 +70,9 @@ export function useGrpcEvents(connectionId: string | null) {
}
// Fetch events from database, filtering out events from other connections and merging atomically
invoke<GrpcEvent[]>('models_grpc_events', { connectionId }).then((events) =>
fireAndForget(invoke<GrpcEvent[]>('models_grpc_events', { connectionId }).then((events) =>
mergeModelsInStore('grpc_event', events, (e) => e.connectionId === connectionId),
);
));
}, [connectionId]);
return useMemo(

View File

@@ -8,6 +8,7 @@ import {
} from '@yaakapp-internal/models';
import { atom, useAtomValue } from 'jotai';
import { useEffect, useMemo } from 'react';
import { fireAndForget } from '../lib/fireAndForget';
import { atomWithKVStorage } from '../lib/atoms/atomWithKVStorage';
import { jotaiStore } from '../lib/jotai';
import { activeRequestIdAtom } from './useActiveRequestId';
@@ -56,9 +57,9 @@ export function useWebsocketEvents(connectionId: string | null) {
}
// Fetch events from database, filtering out events from other connections and merging atomically
invoke<WebsocketEvent[]>('models_websocket_events', { connectionId }).then((events) =>
fireAndForget(invoke<WebsocketEvent[]>('models_websocket_events', { connectionId }).then((events) =>
mergeModelsInStore('websocket_event', events, (e) => e.connectionId === connectionId),
);
));
}, [connectionId]);
return useMemo(

View File

@@ -17,7 +17,7 @@ export function useRequestEditorEvent<
return () => {
emitter.off(event, fn);
};
// biome-ignore lint/correctness/useExhaustiveDependencies: We're handing deps manually
// oxlint-disable-next-line react-hooks/exhaustive-deps -- We're handing deps manually
}, deps);
}

View File

@@ -6,7 +6,7 @@ import { useEffect, useState } from 'react';
*/
export function useStateWithDeps<T>(defaultValue: T | (() => T), deps: DependencyList) {
const [value, setValue] = useState(defaultValue);
// biome-ignore lint/correctness/useExhaustiveDependencies: none
// oxlint-disable-next-line react-hooks/exhaustive-deps
useEffect(() => {
setValue(defaultValue);
}, [...deps]);

View File

@@ -21,7 +21,7 @@ export function useWebsocketRequestActions() {
queryFn: () => getWebsocketRequestActions(),
});
// biome-ignore lint/correctness/useExhaustiveDependencies: none
// oxlint-disable-next-line react-hooks/exhaustive-deps
const actions = useMemo(() => {
return actionsResult.data ?? [];
}, [JSON.stringify(actionsResult.data)]);

View File

@@ -1,5 +1,6 @@
import { getCurrentWebviewWindow } from '@tauri-apps/api/webviewWindow';
import { useEffect, useState } from 'react';
import { fireAndForget } from '../lib/fireAndForget';
export function useWindowFocus() {
const [visible, setVisible] = useState(true);
@@ -10,7 +11,7 @@ export function useWindowFocus() {
});
return () => {
unlisten.then((fn) => fn());
fireAndForget(unlisten.then((fn) => fn()));
};
}, []);

View File

@@ -21,7 +21,7 @@ export function useWorkspaceActions() {
queryFn: () => getWorkspaceActions(),
});
// biome-ignore lint/correctness/useExhaustiveDependencies: none
// oxlint-disable-next-line react-hooks/exhaustive-deps
const actions = useMemo(() => {
return actionsResult.data ?? [];
}, [JSON.stringify(actionsResult.data)]);