From 4d238f4ab2ef82e130917207cc2b24fe437d00e5 Mon Sep 17 00:00:00 2001 From: nicholas-codecov Date: Mon, 13 Jan 2025 10:13:58 -0400 Subject: [PATCH] update comments --- .../BundleSelection/ConfigureCachedBundleModal.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/pages/RepoPage/BundlesTab/BundleContent/BundleSelection/ConfigureCachedBundleModal.tsx b/src/pages/RepoPage/BundlesTab/BundleContent/BundleSelection/ConfigureCachedBundleModal.tsx index ac6de0bcb4..08b02e0d86 100644 --- a/src/pages/RepoPage/BundlesTab/BundleContent/BundleSelection/ConfigureCachedBundleModal.tsx +++ b/src/pages/RepoPage/BundlesTab/BundleContent/BundleSelection/ConfigureCachedBundleModal.tsx @@ -203,6 +203,7 @@ export const ConfigureCachedBundleModal = ({ const { data: bundleData, isLoading: isBundlesLoading } = useQueryV5({ ...CachedBundlesQueryOpts({ provider, owner, repo, branch: defaultBranch }), + // we can use the select hook to transform the data to the format we want select: (data) => data.bundles.map((bundle) => ({ bundleName: bundle.bundleName, @@ -211,12 +212,13 @@ export const ConfigureCachedBundleModal = ({ enabled: isOpen && !!defaultBranch, }) + // if the bundle data is loaded and the bundle state is empty, set the bundle state if (bundleData && bundleData.length > 0 && bundleState.length === 0) { setBundleState(bundleData) } const closeModal = () => { - // this resets the context state when the modal is closed + // this resets the state when the modal is closed setBundleState([]) setIsOpen(false) }