Skip to content

Commit 0a2e51e

Browse files
authored
Release v1.56.1 (#1331)
hotfix: old pipes dont have notificationRecipients
2 parents 162e0cf + b7b24e2 commit 0a2e51e

File tree

7 files changed

+41
-15
lines changed

7 files changed

+41
-15
lines changed

package-lock.json

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/backend/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,5 +111,5 @@
111111
"tsconfig-paths": "^4.2.0",
112112
"type-fest": "4.10.3"
113113
},
114-
"version": "1.56.0"
114+
"version": "1.56.1"
115115
}

packages/backend/src/graphql/custom-resolvers/flow.ts

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,10 @@ import sortBy from 'lodash/sortBy'
33
import { TEMPLATES } from '@/db/storage'
44
import FlowCollaborator from '@/models/flow-collaborators'
55

6-
import type { Resolvers } from '../__generated__/types.generated'
6+
import type {
7+
FlowErrorConfigResolvers,
8+
Resolvers,
9+
} from '../__generated__/types.generated'
710

811
type FlowResolver = Resolvers['Flow']
912

@@ -46,6 +49,20 @@ const role: FlowResolver['role'] = async (parent) => {
4649
return (parent as any)?.role || 'viewer'
4750
}
4851

52+
// in collaborators, we introduced the concept of notificationRecipients,
53+
// which is an array that may contain 'editor' and/or 'viewer'.
54+
// however, there may be existing flows that already have errorConfig.notificationFrequency
55+
// and when returning, may not contain this `notificationRecipients` field
56+
// to avoid gql errors, we force it to return an empty array
57+
const notificationRecipients: FlowErrorConfigResolvers['notificationRecipients'] =
58+
(parent) => {
59+
return parent?.notificationRecipients ?? []
60+
}
61+
62+
export const FlowErrorConfig: FlowErrorConfigResolvers = {
63+
notificationRecipients,
64+
}
65+
4966
export default {
5067
template,
5168
collaborators,

packages/backend/src/graphql/custom-resolvers/index.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import ExecutionStep from './execution-step'
2-
import Flow from './flow'
2+
import Flow, { FlowErrorConfig } from './flow'
33
import FlowCollaborator from './flow-collaborator'
44
import TableMetadata from './table-metadata'
55

@@ -14,4 +14,10 @@ import TableMetadata from './table-metadata'
1414
* schema.gql-to-typescript.ts.
1515
*/
1616

17-
export default { ExecutionStep, TableMetadata, Flow, FlowCollaborator }
17+
export default {
18+
ExecutionStep,
19+
TableMetadata,
20+
Flow,
21+
FlowCollaborator,
22+
FlowErrorConfig,
23+
}

packages/frontend/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "frontend",
3-
"version": "1.56.0",
3+
"version": "1.56.1",
44
"type": "module",
55
"scripts": {
66
"dev": "wait-on tcp:3000 && vite --host --force",

packages/frontend/src/components/EditorSettings/Notifications.tsx

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { NotificationRecipients } from '@plumber/types'
22

3-
import { useCallback, useContext } from 'react'
3+
import { useCallback, useContext, useMemo } from 'react'
44
import { Controller, useFormContext } from 'react-hook-form'
55
import { useMutation } from '@apollo/client'
66
import { Flex, FormControl, Skeleton, Stack, Text } from '@chakra-ui/react'
@@ -119,11 +119,14 @@ export default function Notifications() {
119119
const [updateFlowConfig] = useMutation(UPDATE_FLOW_CONFIG)
120120
const toast = useToast()
121121

122-
const defaultValues = {
123-
frequency,
124-
editor: notificationRecipients.includes(Recipient.Editor),
125-
viewer: notificationRecipients.includes(Recipient.Viewer),
126-
}
122+
const defaultValues = useMemo(
123+
() => ({
124+
frequency,
125+
editor: notificationRecipients.includes(Recipient.Editor),
126+
viewer: notificationRecipients.includes(Recipient.Viewer),
127+
}),
128+
[frequency, notificationRecipients],
129+
)
127130

128131
const onFlowConfigUpdate = useCallback(
129132
async (

packages/types/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
"name": "@plumber/types",
33
"description": "Shared types for plumber",
44
"types": "./index.d.ts",
5-
"version": "1.56.0"
5+
"version": "1.56.1"
66
}

0 commit comments

Comments
 (0)