From 38859d9db8be114a3c1a3a1262e541c55a332aef Mon Sep 17 00:00:00 2001 From: mvdbeek Date: Tue, 16 Jul 2024 17:28:08 +0200 Subject: [PATCH] Simplify and fix `useDatatypesMapper` The problem was that we'd immediately return if `createMapper` had previously been called in another calling stack. I think we don't need to do any error handling here, and the loading state can simply be `datatypesMapperStore.loading`. Fixes https://github.com/galaxyproject/galaxy/issues/18549 --- client/src/composables/datatypesMapper.ts | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/client/src/composables/datatypesMapper.ts b/client/src/composables/datatypesMapper.ts index 706381102ea5..28b2551b08c2 100644 --- a/client/src/composables/datatypesMapper.ts +++ b/client/src/composables/datatypesMapper.ts @@ -11,19 +11,11 @@ export function useDatatypesMapper() { const datatypes: Ref = ref([]); async function getDatatypesMapper() { - try { - await datatypesMapperStore.createMapper(); - datatypesMapper.value = datatypesMapperStore.datatypesMapper; - if (datatypesMapperStore.datatypesMapper) { - datatypes.value = datatypesMapperStore.datatypesMapper.datatypes; - } - } catch (e) { - console.error("unable to create datatypes mapper\n", e); - } finally { - datatypesMapperLoading.value = false; - } - if (!datatypesMapperStore.datatypesMapper) { - throw Error("Error creating datatypesMapper"); + await datatypesMapperStore.createMapper(); + datatypesMapperLoading.value = datatypesMapperStore.loading; + datatypesMapper.value = datatypesMapperStore.datatypesMapper; + if (datatypesMapperStore.datatypesMapper) { + datatypes.value = datatypesMapperStore.datatypesMapper.datatypes; } }