From 7982e1c5f09531ec13f674b356f9f34189fe1fcd Mon Sep 17 00:00:00 2001
From: Remi  PLANEL <rplanel@pasteur.fr>
Date: Thu, 28 Mar 2024 15:26:34 +0100
Subject: [PATCH] compute structure urls

---
 components/content/ArticleStructure.vue |  7 ++++++-
 components/content/RefseqDb.vue         | 10 +++++++---
 nuxt.config.ts                          |  1 +
 3 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/components/content/ArticleStructure.vue b/components/content/ArticleStructure.vue
index bd3192a5..de117c4c 100644
--- a/components/content/ArticleStructure.vue
+++ b/components/content/ArticleStructure.vue
@@ -60,7 +60,12 @@ const sanitizedStructures = computed(() => {
     if (toValStructures?.hits?.length > 0) {
 
         return toValStructures.hits.map(item => {
-            return { ...item, structuresUrls: [`/${item.System_name_ok}/${pdbNameToCif(item.pdb)}`, `/${item.System_name_ok}/${item.pdb}`] }
+            return {
+                ...item, structuresUrls: [`/${item.System_name_ok}/${pdbNameToCif(item.pdb)}`, `/${item.System_name_ok}/${item.pdb}`]
+                    .map(url => {
+                        return toValue(useRefinedUrl(url).refinedUrl)
+                    })
+            }
         })
     }
     return []
diff --git a/components/content/RefseqDb.vue b/components/content/RefseqDb.vue
index f0528b29..80b49c50 100644
--- a/components/content/RefseqDb.vue
+++ b/components/content/RefseqDb.vue
@@ -289,12 +289,16 @@ const computedTaxonomyDistribution = computed(() => {
     const toValSelectedTaxoRank = toValue(selectedTaxoRank)
     const toValFacetsPerRank = toValue(msResult)?.facetDistribution?.[toValSelectedTaxoRank]
     if (toValFacetsPerRank) {
-        return Object.entries(toValFacetsPerRank).map(([key, value]) => {
-            return {
+        const listFacetsPerRank = Object.entries(toValFacetsPerRank)
+        const result = new Array(listFacetsPerRank.length);
+        for (let i = 0; listFacetsPerRank.length; i++) {
+            const [key, value] = listFacetsPerRank[i]
+            result[i] = {
                 [toValSelectedTaxoRank]: key,
                 count: value
             }
-        }).sort()
+        }
+        return result.sort()
     } else { return [] }
 
 })
diff --git a/nuxt.config.ts b/nuxt.config.ts
index 419aead0..a38f2c06 100644
--- a/nuxt.config.ts
+++ b/nuxt.config.ts
@@ -1,6 +1,7 @@
 import { md3 } from 'vuetify/blueprints'
 // https://v3.nuxtjs.org/api/configuration/nuxt.config
 export default defineNuxtConfig({
+  // ssr: false,
   modules: [
     '@unocss/nuxt',
     '@nuxt/content',
-- 
GitLab