use set not map

This commit is contained in:
Dallin Romney 2025-01-18 14:13:55 -08:00
parent a4c225fee2
commit df2d10a3df

View file

@ -117,7 +117,7 @@ export const SubmenuContextProvidersProvider = ({
};
}, [ideMessenger]);
const providersLoading = useRef(new Map<string, boolean>()).current;
const providersLoading = useRef(new Set<string>()).current;
const getSubmenuContextItems = useCallback(
(
@ -192,7 +192,7 @@ export const SubmenuContextProvidersProvider = ({
}
} else {
// Otherwise just check if the provider is loading
if (providersLoading.get(providerTitle)) {
if (providersLoading.has(providerTitle)) {
return loadingFiller;
}
}
@ -223,10 +223,10 @@ export const SubmenuContextProvidersProvider = ({
submenuContextProviders.map(
async (description: ContextProviderDescription) => {
try {
if (providersLoading.get(description.title)) {
if (providersLoading.has(description.title)) {
return;
}
providersLoading.set(description.title, true);
providersLoading.add(description.title);
const refreshProvider =
providers === "all"
@ -303,7 +303,7 @@ export const SubmenuContextProvidersProvider = ({
JSON.stringify(error, Object.getOwnPropertyNames(error)),
);
} finally {
providersLoading.set(description.title, false);
providersLoading.delete(description.title);
}
},
),