Merge pull request #3120 from Infisical/is-pending-fixes

Improvement: Use isPending Over isLoading
This commit is contained in:
Scott Wilson
2025-02-14 09:10:05 -08:00
committed by GitHub
4 changed files with 9 additions and 9 deletions
@@ -10,9 +10,9 @@ type Props = {
}; };
export const SecretSyncSelect = ({ onSelect }: Props) => { export const SecretSyncSelect = ({ onSelect }: Props) => {
const { isLoading, data: secretSyncOptions } = useSecretSyncOptions(); const { isPending, data: secretSyncOptions } = useSecretSyncOptions();
if (isLoading) { if (isPending) {
return ( return (
<div className="flex h-full flex-col items-center justify-center py-2.5"> <div className="flex h-full flex-col items-center justify-center py-2.5">
<Spinner size="lg" className="text-mineshaft-500" /> <Spinner size="lg" className="text-mineshaft-500" />
@@ -23,7 +23,7 @@ export const SecretSyncConnectionField = ({ onChange: callback }: Props) => {
const destination = watch("destination"); const destination = watch("destination");
const app = SECRET_SYNC_CONNECTION_MAP[destination]; const app = SECRET_SYNC_CONNECTION_MAP[destination];
const { data: availableConnections, isLoading } = useListAvailableAppConnections(app); const { data: availableConnections, isPending } = useListAvailableAppConnections(app);
const connectionName = APP_CONNECTION_MAP[app].name; const connectionName = APP_CONNECTION_MAP[app].name;
@@ -54,7 +54,7 @@ export const SecretSyncConnectionField = ({ onChange: callback }: Props) => {
onChange(newValue); onChange(newValue);
if (callback) callback(); if (callback) callback();
}} }}
isLoading={isLoading} isLoading={isPending}
options={availableConnections} options={availableConnections}
placeholder="Select connection..." placeholder="Select connection..."
getOptionLabel={(option) => option.name} getOptionLabel={(option) => option.name}
@@ -11,9 +11,9 @@ type Props = {
}; };
export const AppConnectionsSelect = ({ onSelect }: Props) => { export const AppConnectionsSelect = ({ onSelect }: Props) => {
const { isLoading, data: appConnectionOptions } = useAppConnectionOptions(); const { isPending, data: appConnectionOptions } = useAppConnectionOptions();
if (isLoading) { if (isPending) {
return ( return (
<div className="flex h-full flex-col items-center justify-center py-2.5"> <div className="flex h-full flex-col items-center justify-center py-2.5">
<Spinner size="lg" className="text-mineshaft-500" /> <Spinner size="lg" className="text-mineshaft-500" />
@@ -51,7 +51,7 @@ type AppConnectionFilters = {
}; };
export const AppConnectionsTable = () => { export const AppConnectionsTable = () => {
const { isLoading, data: appConnections = [] } = useListAppConnections(); const { isPending, data: appConnections = [] } = useListAppConnections();
const { popUp, handlePopUpOpen, handlePopUpToggle } = usePopUp([ const { popUp, handlePopUpOpen, handlePopUpToggle } = usePopUp([
"deleteConnection", "deleteConnection",
@@ -262,7 +262,7 @@ export const AppConnectionsTable = () => {
</Tr> </Tr>
</THead> </THead>
<TBody> <TBody>
{isLoading && ( {isPending && (
<TableSkeleton innerKey="app-connections-table" columns={4} key="app-connections" /> <TableSkeleton innerKey="app-connections-table" columns={4} key="app-connections" />
)} )}
{filteredAppConnections.slice(offset, perPage * page).map((connection) => ( {filteredAppConnections.slice(offset, perPage * page).map((connection) => (
@@ -285,7 +285,7 @@ export const AppConnectionsTable = () => {
onChangePerPage={setPerPage} onChangePerPage={setPerPage}
/> />
)} )}
{!isLoading && !filteredAppConnections?.length && ( {!isPending && !filteredAppConnections?.length && (
<EmptyState <EmptyState
title={ title={
appConnections.length appConnections.length