From 8c70f6b2b31d6e30e503e68900e22f38571e3c9e Mon Sep 17 00:00:00 2001 From: Carlos Quiroz Date: Mon, 4 Nov 2024 23:38:05 -0300 Subject: [PATCH] Adapt new schema to remmove deleted targets --- .../src/clue/scala/queries/common/TargetQueriesGQL.scala | 3 ++- .../main/scala/explore/cache/CacheModifierUpdaters.scala | 9 +++++---- project/Versions.scala | 4 ++-- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/explore/src/clue/scala/queries/common/TargetQueriesGQL.scala b/explore/src/clue/scala/queries/common/TargetQueriesGQL.scala index deab64a354..d9cacec86e 100644 --- a/explore/src/clue/scala/queries/common/TargetQueriesGQL.scala +++ b/explore/src/clue/scala/queries/common/TargetQueriesGQL.scala @@ -75,7 +75,7 @@ object TargetQueriesGQL: val document = """ subscription($targetId: TargetId!) { targetEdit(input: {targetId: $targetId}) { - id + targetId } } """ @@ -85,6 +85,7 @@ object TargetQueriesGQL: val document = s""" subscription($$input: TargetEditInput!) { targetEdit(input: $$input) { + targetId value $TargetWithIdSubquery meta:value { existence diff --git a/explore/src/main/scala/explore/cache/CacheModifierUpdaters.scala b/explore/src/main/scala/explore/cache/CacheModifierUpdaters.scala index 331bf70f0f..796f61d0ae 100644 --- a/explore/src/main/scala/explore/cache/CacheModifierUpdaters.scala +++ b/explore/src/main/scala/explore/cache/CacheModifierUpdaters.scala @@ -32,10 +32,11 @@ trait CacheModifierUpdaters { protected def modifyTargets(targetEdit: TargetEdit): ProgramSummaries => ProgramSummaries = ProgramSummaries.targets .modify: targets => - if (targetEdit.meta.existence === Existence.Present) - targets.updated(targetEdit.value.id, targetEdit.value.target) - else - targets.removed(targetEdit.value.id) + if (targetEdit.meta.exists(_.existence === Existence.Present)) + targetEdit.value + .map(t => targets.updated(targetEdit.targetId, t.target)) + .getOrElse(targets.removed(targetEdit.targetId)) + else targets.removed(targetEdit.targetId) protected def modifyObservations( observationEdit: ObservationEdit diff --git a/project/Versions.scala b/project/Versions.scala index 463bfc0eed..1c5bfedf2a 100644 --- a/project/Versions.scala +++ b/project/Versions.scala @@ -26,8 +26,8 @@ object Versions { val lucumaITC = "0.22.6" val lucumaReact = "0.71.2" val lucumaRefined = "0.1.3" - val lucumaSchemas = "0.106.0" - val lucumaOdbSchema = "0.16.0" + val lucumaSchemas = "0.107.0" + val lucumaOdbSchema = "0.16.1" val lucumaSSO = "0.6.27" val lucumaUI = "0.121.0" val monocle = "3.3.0"