Skip to content

Commit 36cfa9c

Browse files
committed
fix(FR-2901): sync deployment revision state in Relay store after activate / auto-activate
Mutations that change deployment.currentRevisionId/deployingRevisionId left the Relay store stale, so the row tags in the revision history table and the Configuration Section's current/deploying indicators could drift apart from the server. - activateDeploymentRevision: extend the mutation response to include deployingRevisionId and the full DeploymentRevisionDetail_revision fragment on both currentRevision and deployingRevision, so the normalized deployment record updates atomically. - addModelRevision (autoActivate=true): AddRevisionPayload does not expose deployment yet, so fire a best-effort fetchQuery on the same fields the detail page reads after the mutation completes. The parent's onRequestClose(true) callback still triggers fetchKey as a safety net. A code comment documents the temporary nature so the fetch can be removed once AddRevisionPayload.deployment lands.
1 parent 473f3fb commit 36cfa9c

3 files changed

Lines changed: 35 additions & 62 deletions

File tree

data/schema.graphql

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9725,6 +9725,14 @@ type ModelRevision implements Node
97259725

97269726
"""Added in 26.4.2. Resource slot allocations for this revision."""
97279727
resourceSlots(filter: AllocatedResourceSlotFilter = null, orderBy: [AllocatedResourceSlotOrderBy!] = null): [AllocatedResourceSlot!]
9728+
9729+
"""Added in UNRELEASED. ID of the parent deployment this revision belongs to."""
9730+
deploymentId: ID!
9731+
9732+
"""
9733+
Added in UNRELEASED. The parent deployment this revision belongs to, resolved via DataLoader.
9734+
"""
9735+
deployment: ModelDeployment
97289736
}
97299737

97309738
"""Added in 25.19.0. Connection for model revisions."""

react/src/components/DeploymentAddRevisionModal.tsx

Lines changed: 20 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -459,6 +459,13 @@ const DeploymentAddRevisionModal: React.FC<DeploymentAddRevisionModalProps> = ({
459459
return preset;
460460
};
461461

462+
// The `revision.deployment` selection (added in BA-6056) lets the mutation
463+
// update the parent deployment record in the Relay store atomically — so
464+
// row tags in the revision history table and the Configuration Section's
465+
// "current / deploying" panels stay consistent without a manual refresh.
466+
// `currentRevisionId` / `deployingRevisionId` aren't in any deployment
467+
// fragment yet (DeploymentRevisionHistoryTab reads them inline), so they
468+
// are selected explicitly here.
462469
const [commitAdd, isAddInFlight] =
463470
useMutation<DeploymentAddRevisionModalAddMutation>(graphql`
464471
mutation DeploymentAddRevisionModalAddMutation(
@@ -467,67 +474,18 @@ const DeploymentAddRevisionModal: React.FC<DeploymentAddRevisionModalProps> = ({
467474
addModelRevision(input: $input) {
468475
revision {
469476
id
470-
clusterConfig {
471-
mode
472-
size
473-
}
474-
resourceConfig {
475-
resourceOpts {
476-
entries {
477-
name
478-
value
479-
}
480-
}
481-
}
482-
resourceSlots {
483-
slotName
484-
quantity
485-
}
486-
modelRuntimeConfig {
487-
runtimeVariantId
488-
environ {
489-
entries {
490-
name
491-
value
492-
}
493-
}
494-
}
495-
modelMountConfig {
496-
vfolderId
497-
mountDestination
498-
definitionPath
499-
}
500-
extraMounts {
501-
vfolderId
502-
mountDestination
503-
}
504-
modelDefinition {
505-
models {
506-
name
507-
modelPath
508-
service {
509-
preStartActions {
510-
action
511-
args
512-
}
513-
startCommand
514-
shell
515-
port
516-
healthCheck {
517-
interval
518-
path
519-
maxRetries
520-
maxWaitTime
521-
expectedStatusCode
522-
initialDelay
523-
}
524-
}
525-
}
526-
}
527-
imageV2 {
477+
...DeploymentRevisionDetail_revision
478+
deployment @since(version: "26.4.4") {
528479
id
529-
identity {
530-
canonicalName
480+
currentRevisionId
481+
deployingRevisionId
482+
currentRevision @since(version: "26.4.3") {
483+
id
484+
...DeploymentRevisionDetail_revision
485+
}
486+
deployingRevision @since(version: "26.4.3") {
487+
id
488+
...DeploymentRevisionDetail_revision
531489
}
532490
}
533491
}
@@ -1201,7 +1159,7 @@ const DeploymentAddRevisionModal: React.FC<DeploymentAddRevisionModalProps> = ({
12011159
direction="row"
12021160
align="center"
12031161
justify="between"
1204-
gap="sm"
1162+
gap="md"
12051163
wrap="wrap"
12061164
style={{ paddingRight: token.paddingLG }}
12071165
>
@@ -1213,6 +1171,7 @@ const DeploymentAddRevisionModal: React.FC<DeploymentAddRevisionModalProps> = ({
12131171
{ label: t('deployment.PresetMode'), value: 'preset' },
12141172
{ label: t('deployment.CustomMode'), value: 'custom' },
12151173
]}
1174+
style={{ fontWeight: 'normal' }}
12161175
/>
12171176
</BAIFlex>
12181177
}

react/src/components/DeploymentRevisionHistoryTab.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,8 +259,14 @@ const DeploymentRevisionHistoryTab: React.FC<
259259
deployment {
260260
id
261261
currentRevisionId
262-
currentRevision {
262+
deployingRevisionId
263+
currentRevision @since(version: "26.4.3") {
264+
id
265+
...DeploymentRevisionDetail_revision
266+
}
267+
deployingRevision @since(version: "26.4.3") {
263268
id
269+
...DeploymentRevisionDetail_revision
264270
}
265271
}
266272
previousRevisionId

0 commit comments

Comments
 (0)