Skip to content

Commit

Permalink
tidy up isPending
Browse files Browse the repository at this point in the history
  • Loading branch information
nicholas-codecov committed Jan 13, 2025
1 parent 4d238f4 commit b1ce75a
Showing 1 changed file with 13 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -134,13 +134,13 @@ const BundleTable: React.FC<BundleTableProps> = ({
interface BundleCachingModalBodyProps {
bundleState: CachedBundle[]
setBundleState: SetBundleState
isBundlesLoading: boolean
isBundlesPending: boolean
}

const BundleCachingModalBody: React.FC<BundleCachingModalBodyProps> = ({
bundleState,
setBundleState,
isBundlesLoading,
isBundlesPending,
}) => {
return (
<>
Expand All @@ -157,7 +157,7 @@ const BundleCachingModalBody: React.FC<BundleCachingModalBodyProps> = ({
Note, if caching is removed trend data will not be available.
</Alert.Description>
</Alert>
{isBundlesLoading ? (
{isBundlesPending ? (
<Loader />
) : (
<BundleTable
Expand Down Expand Up @@ -188,11 +188,12 @@ export const ConfigureCachedBundleModal = ({
const { provider, owner, repo } = useParams<URLParams>()
const [bundleState, setBundleState] = useState<CachedBundle[]>([])

const { mutate: updateBundleCache, isPending } = useUpdateBundleCache({
provider,
owner,
repo,
})
const { mutate: updateBundleCache, isPending: updateBundleCachePending } =
useUpdateBundleCache({
provider,
owner,
repo,
})

const { data: repoOverview } = useRepoOverview({
provider,
Expand All @@ -201,7 +202,7 @@ export const ConfigureCachedBundleModal = ({
})
const defaultBranch = repoOverview?.defaultBranch ?? ''

const { data: bundleData, isLoading: isBundlesLoading } = useQueryV5({
const { data: bundleData, isPending: isBundlesPending } = useQueryV5({
...CachedBundlesQueryOpts({ provider, owner, repo, branch: defaultBranch }),
// we can use the select hook to transform the data to the format we want
select: (data) =>
Expand Down Expand Up @@ -232,7 +233,7 @@ export const ConfigureCachedBundleModal = ({
<BundleCachingModalBody
bundleState={bundleState}
setBundleState={setBundleState}
isBundlesLoading={isBundlesLoading}
isBundlesPending={isBundlesPending}
/>
}
footer={
Expand All @@ -244,15 +245,15 @@ export const ConfigureCachedBundleModal = ({
<div className="flex items-center gap-2">
<Button
hook="cancel-bundle-caching-modal"
disabled={isPending || isBundlesLoading}
disabled={updateBundleCachePending || isBundlesPending}
onClick={() => closeModal()}
>
Cancel
</Button>
<Button
hook="save-bundle-caching-modal"
variant="primary"
disabled={isPending || isBundlesLoading}
disabled={updateBundleCachePending || isBundlesPending}
onClick={() => {
updateBundleCache(bundleState, {
onError: (error) => {
Expand Down

0 comments on commit b1ce75a

Please sign in to comment.