Skip to content

Commit 835bc12

Browse files
committed
fix: assertUpdatedSince for updateFlow
1 parent f148724 commit 835bc12

File tree

3 files changed

+6
-7
lines changed

3 files changed

+6
-7
lines changed

packages/backend/src/graphql/mutations/update-flow.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,12 @@ const updateFlow: MutationResolvers['updateFlow'] = async (
1212
})
1313
.throwIfNotFound()
1414

15+
flow.assertNotUpdatedSince(params.input.updatedAt, context.currentUser.id)
16+
1517
return await flow.$query().patchAndFetch({
1618
name: params.input.name,
19+
updatedAt: new Date().toISOString(),
20+
updatedBy: context.currentUser.id,
1721
})
1822
}
1923

packages/backend/src/graphql/schema.graphql

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -514,6 +514,7 @@ input CreateTemplatedFlowInput {
514514
input UpdateFlowInput {
515515
id: String!
516516
name: String!
517+
updatedAt: String!
517518
}
518519

519520
input UpdateFlowStatusInput {

packages/frontend/src/components/EditorLayout/index.tsx

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -83,13 +83,7 @@ export default function EditorLayout() {
8383
input: {
8484
id: flowId,
8585
name,
86-
},
87-
},
88-
optimisticResponse: {
89-
updateFlow: {
90-
__typename: 'Flow',
91-
id: flow?.id,
92-
name,
86+
updatedAt: flow?.updatedAt,
9387
},
9488
},
9589
})

0 commit comments

Comments
 (0)