diff --git a/server.R b/server.R
index bf166469829c4da0f80ae7a8744c1cbe10f32027..b9a900b8ea1ad54070aa817928ee2cae8dc85b81 100644
--- a/server.R
+++ b/server.R
@@ -1,35 +1,58 @@
  server <- function(input, output) {
 
-  filteredData <- reactive({
-    req(input$daterange)
-    all_data %>%
-      filter(updated_at >= as.Date(input$daterange[[1]]) & updated_at <= as.Date(input$daterange[[2]]))
-  })
-  observeEvent(input$daterange,{
-    updateSelectizeInput(inputId = "idprojet",label = "Projet : ",
-                           choices = unique(filteredData()$project_name))
+   r <- reactiveValues(filteredData = NULL, filteredData2 = NULL)
+   # Daterange ----
+   observeEvent(input$daterange, {
+     req(input$daterange)
+     r$filteredData <- all_data %>%
+       filter(updated_at >= as.Date(input$daterange[[1]]) &
+                updated_at <= as.Date(input$daterange[[2]]))
+     updateSelectizeInput(
+       inputId = "idprojet",
+       label = "Projet : ",
+       choices = unique(r$filteredData$project_name)
+     )
+   })#----↑Observe Daterange
+  observeEvent(input$idprojet,{
     output$lien <- renderUI({
-      # Générer une liste d'URLs basée sur input$idprojet
-      urls <- paste0("https://gitlab-forge.din.developpement-durable.gouv.fr/dreal-pdl/csd/", input$idprojet)
-
-      # Créer une liste de balises <a> pour chaque lien
+      urls <- paste0("https://gitlab-forge.din.developpement-durable.gouv.fr/dreal-pdl/csd/", input$idprojet)      # Générer une liste d'URLs basée sur input$idprojet
       links <- lapply(seq_along(input$idprojet), function(i) {
         a(href = urls[i], target = "_blank", input$idprojet[i])
-      })
+      }
+      )       # Créer une liste de balises <a> pour chaque lien
+      do.call(tagList, c(links, list(br())))       # Retourner les liens avec un saut de ligne après chacun
+    })
+
+    r$filteredData2 <- r$filteredData %>% dplyr::filter(project_name %in% input$idprojet )
+
+    #2eme graph
+    output$filteredPlot2 <- plotly::renderPlotly({
+      req(input$idprojet,cancelOutput = TRUE)
+      p <- ggplot2::ggplot(r$filteredData2, ggplot2::aes(x = updated_at, y = as.factor(project_name))) +
+        ggplot2::geom_jitter(ggplot2::aes(color = type, text = paste(updated_at, message, sep = "\n")),
+                             size = 3, alpha = 0.5,
+                             height = 0, width = 0.75
+        ) +
+        ggplot2::labs(shape = "Type", color = "Type", x = "") +
+        ggplot2::scale_x_datetime(date_labels = "%d/%m", timezone = "Europe/Paris") +
+        gouvdown::theme_gouv() +
+        ggplot2::theme(
+          axis.text.x = ggplot2::element_text(angle = 0, hjust = 1),
+          axis.title.y = ggplot2::element_blank()
+        ) +
+        gouvdown::scale_color_gouv_discrete(palette = "pal_gouv_qual2")
 
-      # Retourner les liens avec un saut de ligne après chacun
-      do.call(tagList, c(links, list(br())))
 
+      plotly::ggplotly(p, tooltip = "text")
     })
-  })
 
-  filteredData2 <- reactive({
-    req(input$idprojet)
-    filteredData() %>% dplyr::filter(project_name %in% input$idprojet )
-  })
+  }) #----↑Observe idprojet----↑↑↑↑↑↑
+
+
 
   output$filteredPlot <- plotly::renderPlotly({
-    p <- ggplot2::ggplot(filteredData(), ggplot2::aes(x = updated_at, y = as.factor(project_name))) +
+    req(input$daterange)
+    p <- ggplot2::ggplot(r$filteredData, ggplot2::aes(x = updated_at, y = as.factor(project_name))) +
       ggplot2::geom_jitter(ggplot2::aes(color = type, text = paste(updated_at, message, sep = "\n")),
         size = 3, alpha = 0.5,
         height = 0, width = 0.75
@@ -47,23 +70,6 @@
     plotly::ggplotly(p, tooltip = "text")
   })
 
-  #2eme graph
-  output$filteredPlot2 <- plotly::renderPlotly({
-    p <- ggplot2::ggplot(filteredData2(), ggplot2::aes(x = updated_at, y = as.factor(project_name))) +
-      ggplot2::geom_jitter(ggplot2::aes(color = type, text = paste(updated_at, message, sep = "\n")),
-                           size = 3, alpha = 0.5,
-                           height = 0, width = 0.75
-      ) +
-      ggplot2::labs(shape = "Type", color = "Type", x = "") +
-      ggplot2::scale_x_datetime(date_labels = "%d/%m", timezone = "Europe/Paris") +
-      gouvdown::theme_gouv() +
-      ggplot2::theme(
-        axis.text.x = ggplot2::element_text(angle = 0, hjust = 1),
-        axis.title.y = ggplot2::element_blank()
-      ) +
-      gouvdown::scale_color_gouv_discrete(palette = "pal_gouv_qual2")
 
 
-    plotly::ggplotly(p, tooltip = "text")
-  })
 }